views:

22

answers:

1

Hello,

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?

+1  A: 

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.

eBusiness