Forum Moderators: open

Message Too Old, No Replies

image button under Netscape 4.75

submit and reset action

         

silogic

8:38 am on Oct 8, 2003 (gmt 0)



I would like to execute a javascript (document.forms[0].variable.value='PDF') and submit the form using image button.
And I would like reset the form using image button.

DrDoc

3:15 pm on Oct 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

Image button = submit button.

Sure, you could control the actual action that is taken using a JavaScript (to either submit the form or reset it). But what if someone has JavaScript turned off?

Do this instead (or in addition to your JS function):

<input type="image" name="submit" src="whatever.gif">
<input type="image" name="reset" src="whatever.gif">

Then, in your script (Perl or PHP) do something like the following:

if($submit_x) {
# the form was submitted
# do stuff
}
else {
# $reset_x was set instead
# reset form (=send back to previous page)
}