Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to determine form element that triggered the onSubmit ?

Status
Not open for further replies.

swissneil

Programmer
Jan 11, 2001
5
CH
Is it possible to determine form element's name that triggered the onSubmit ?
 
not in the onsubmit, because that's an event of the form object, you could test on the individual elements onclick events and onkeyup events though... jared@aauser.com
 
Is it possible to to see what the Submitted value is
for example if I press the following button
<input type=&quot;submit&quot; name=&quot;myvalue&quot;>
is it possible to see this value &quot;myvalue&quot; submitted in a string eg name value pair or something like that anywhere.Can I test against this requested value.
 
you can capture the value:

<input type=&quot;submit&quot; value=&quot;submit1&quot; name=&quot;myvalue&quot;>
jared@aauser.com
 
Thanx jaredn

You see to make it a bit clearer.I need to know which form element made my
submit or request to the JAVA Servlet.The java bit is not important here but
I have to validate some object and if my <input type=&quot;image&quot;...> was not used
for the submit I need to cancel the submit by returning false depending on a
certain dropdown value selected.So in other cases eg. with buttons in the same
form the submit will return true.

maybe it is a bit clearer know or maybe not.
Thanx for your help in any case
 
ummm, maybe onclick of whatever button they use to submit, set a hidden input fields value and test against that on servlet jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top