[thelist] How do I submit a single form thru either of two links using JavaScript AND pass a hidden value depending on the link?

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Wed Apr 20 12:01:14 CDT 2005


(and now let me finish the message before replying)

That's probably what I'd recommend.

Of course if your user doesn't have Javascript enabled, then that won't work.  Instead, you could have two submit buttons, and the version would be determined by the value of the button that was sent back with the form data.

 From: Ivo P ipletikosic at gmail.com

Hello friends,

I have a form that is submitted using JavaScript. There are two links
that can submit the form but I want an additional hidden value
returned to the server depending on which link was clicked. Like this:

The Form:

Select your platform:

Windows

Mac

Linux

The JavaScript:

Download v1.0");
document.write("
");
document.write("Download v1.0.1");
-->

The problem:

Clicking either link should submit the form myform1 but depending on
which link was clicked an additional hidden value (say version='1.0'
or version='1.0.1') should be sent back with the form.

Any pointers on how to accomplish this?

My initial guess (I am new at this) is to include an additional hidden
field in the original form called version. When a user clicks one of
the links a function is called where it rewrites the value of the
field (document.myform1.version.value = '1.0';) and only then it
submits it.

Does this sound correct?

Thanks for the help,

I.



More information about the thelist mailing list