Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q619 If a form has two submit buttons with the same name and different values, how can an onSubmit handler tell which button submitted the form?

You are here: irt.org | FAQ | JavaScript | Form | 7.2 | Q619 [ previous next ]

By using the onClick event handler:

<FORM onSubmit="alert(button + ' pressed')">
<INPUT TYPE="SUBMIT" onClick="button=this.value" VALUE="Button One">
<INPUT TYPE="SUBMIT" onClick="button=this.value" VALUE="Button Two">
</FORM>

Feedback on 'Q619 If a form has two submit buttons with the same name and different values, how can an onSubmit handler tell which button submitted the form?'

©2018 Martin Webb