Forum Moderators: coopster

Message Too Old, No Replies

Trapping for the return/enter key

When you've got more than one submit button

         

neophyte

6:51 am on Oct 27, 2006 (gmt 0)

10+ Year Member



I've written a script that spans multiple html pages.

Each page (after the first one) has two submit buttons - one to continue to the next page, the other to go back to the previous page to correct/alter pre-entered information.

While I was testing and tabbing through a field list on the second page, I accidently hit the return key instead of the tab key which activated the "previous page" button and I was suddenly and unexpectly on the previous page... which was a big surpise for me!

Is there a way to "trap" for return or enter key activation so I can stop this from happening to a user when this app is deployed? Or, at least, send the user to the NEXT page if one of these keys are pressed, rather than the previous one?

I don't know if this the right forum for this question, but any insight on how I can deal with this would be appreciated.

Neophyte

IamStang

11:21 am on Oct 27, 2006 (gmt 0)

10+ Year Member



My thought would be to disable the use of the "enter" key by means of javascript. Info here [google.com]. However, that might not be the best way as many folks have javascript turned off. Other than javascript, I am uncertain if there is another way to do what you need.

Good Luck!
IamStang