Input Submits in Explorer

D

David Williams

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.value"

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; ?>"

</form>

</html>
 
R

RobG

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.value"

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;
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.

[...]
 
D

David Williams

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
 
R

RobG

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top