Ariod
Ariod

Reputation: 5851

Dojo - finding out which button was clicked on submitting a form

If I connect to my form's onSubmit event, how can I find out which button on the form was used for submit? Or, if the form was submitted by pressing the Enter key on an element, how can I find out which element was in focus?

I cannot rely on ExplicitOriginalTarget property of the event object, as this is Mozilla-specific.

Any suggestions?

Upvotes: 0

Views: 326

Answers (1)

aaaaaaaaaaaa
aaaaaaaaaaaa

Reputation: 3700

Don't use submit buttons, you can easily run a script when a button is pressed, in that script you may submit the form (simply call the forms .submit() method), that way you will easily know what button was pressed, and any submit not originating from your code must then of course originate from the user pressing enter.

Upvotes: 1

Related Questions