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

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Thu Apr 21 00:20:09 CDT 2005


	Good deal.  By the way, if you ever don't have JS but look and
feel is still an issue, you could always do input type=image instead of
submit, and create images to resemble your links.

-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Ivo P

Thanks for the replies people. Turns out it was a lot simpler than I
initally thought, a very simple JavaScript fn took care of the hidden
field as I had initially thought:

The two submit buttons isnt an option, the look-n-feel drafted by the
designer doesnt take into account buttons. No worries tho, the client
controls the browsers where this app will eventually be deployed so
having JS enabled is guaranteed.

Thanks!

Ivo

On 4/20/05, Peter Brunone (EasyListBox.com) <peter at easylistbox.com>
wrote:
> (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:
> 
>  
> 
> 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