Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Input Submits in Explorer

Reply
Thread Tools

Input Submits in Explorer

 
 
David Williams
Guest
Posts: n/a
 
      10-31-2007
Hello all, I need help submitting this
data to a form which works in Firefox
but not IE 7. I have an image (but.bmp)
that when clicked, submits the data to the
next php page. Works fine in Firefox. Does
not work in IE so I made a hidden input
field which changes value via the following
javascript:

onClick="document.myform.hiddenObject.value=this.v alue"

The this.value seems to be the problem because
it is not evaluating to 5



The this.value seems to be the problem
because it is not evaluating to 5 like it
should. Is this not the proper syntax? I did
a view source on the page and everything looks
good except the this.value. The browser takes that
literally ( this.value ) rather than evaluating
it to (5)





Here is the code:
Thanks for any help


<title>Test</title>

</head>
<body>

<?
$temp_id=5;
$name="temp_id1";
?>

</body>

<form name="myform" action="page2.php" method="post">
<INPUT TYPE="hidden" NAME="hiddenObject" VALUE="">

<input type="image"
src="but.bmp"

name="<?php echo $name; ?>"
value="<?php echo $temp_id;?>"
onClick="document.myform.hiddenObject.value=this.v alue"
>


</form>

</html>
















--
David Williams
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      10-31-2007
On Oct 31, 11:03 am, David Williams <(E-Mail Removed)> wrote:
> Hello all, I need help submitting this
> data to a form which works in Firefox
> but not IE 7. I have an image (but.bmp)
> that when clicked, submits the data to the
> next php page. Works fine in Firefox. Does
> not work in IE so I made a hidden input
> field which changes value via the following
> javascript:
>
> onClick="document.myform.hiddenObject.value=this.v alue"


IE does not include the value of the input type image when submitting
a form, it only sends the x and y coordinates.


> The this.value seems to be the problem because
> it is not evaluating to 5


It should evaluate to whatever the value of the control has been set
to, the following simple test works for me in IE 6:

<form>
<input type="hidden" name="hiddenObject" value="">
<input type="image" src="foo.gif" name="steve" onclick="
this.form.hiddenObject.value = this.value;
" value="27">
</form>


> The this.value seems to be the problem
> because it is not evaluating to 5 like it
> should.


Use an alert to see the value before the form is posted.


> Is this not the proper syntax? I did
> a view source on the page and everything looks
> good except the this.value. The browser takes that
> literally ( this.value ) rather than evaluating
> it to (5)


That may be a result of the value of the onclick attribute not being
properly quoted, however since you didn't post the page source we
can't tell.


> Here is the code:
> Thanks for any help
>
> <title>Test</title>
>
> </head>
> <body>
>
> <?
> $temp_id=5;
> $name="temp_id1";
> ?>


Please don't post server code, use view source in a browser to post
what the client is actually getting.

[...]


--
Rob

 
Reply With Quote
 
 
 
 
David Williams
Guest
Posts: n/a
 
      10-31-2007

Good point about posting the browser code.
What I originally posted actually works, it just does not work in a loop.
I have hacked ( I don't like I how I did it ) the problem by
having a differently named hiddenObject name for each iteration of the loop.

I will post some more if I figure out how to do it the right way i.e.
using the this.value

Thanks
David


--
David Williams
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: (E-Mail Removed)
 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      11-01-2007
On Nov 1, 2:47 am, David Williams <(E-Mail Removed)> wrote:
> Good point about posting the browser code.
> What I originally posted actually works, it just does not work in a loop.
> I have hacked ( I don't like I how I did it ) the problem by
> having a differently named hiddenObject name for each iteration of the loop.
>
> I will post some more if I figure out how to do it the right way i.e.
> using the this.value


If you post the code you are using now (or a useful section of it) you
might get advice on how to "do it properly" now.

I can guess that your loop either incorrectly increments or you are
not getting the value you expect for the this keyword. I can't help
further without seeing the code and some of the related HTML.


--
Rob

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer 8: C:\Program Files\Internet Explorer\iexplore.exe vs C:\Program Files (x86)\Internet Explorer\iexplore.exe Nathan Sokalski Windows 64bit 16 02-22-2010 08:31 AM
input submits regardless of event return; explain this fix please okey Javascript 3 10-03-2009 08:09 AM
input image submits x,y jshanman HTML 8 10-04-2008 07:31 PM
Run JavaScript before Form Submits Scott M. ASP .Net 14 11-18-2003 09:28 AM
Help needed with form submits and Perl handling Robert V Perl 1 07-21-2003 05:00 AM



Advertisments