Forum Moderators: open

Message Too Old, No Replies

Default form submit button

How to deal with multiple forum submits

         

Quagmire

3:22 pm on Jun 24, 2003 (gmt 0)

10+ Year Member



I have some situations where I need two or more submit buttons in one form. Sometimes the additional buttons act as cancel, sometimes they submit and do something different than the normal submit.

The problem is when the user hits the Enter key, it uses the first button, and in most cases I want it to submit using the last one. Is there any way to specify which button is the default? I tried tabindex, and it didn't do anything.

Thanks

tedster

7:06 am on Jun 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From what I've read, this area (form submit on Enter) is still a mess, with more browser complications than you want to think about and no real standards.

If the browser gets confused, then it's likely your user will be confused as well. So I'd suggest that you "don't go there" and instead try to simplify the situation. Try to sort out the logic so you have one form with one submit button that does only one thing. Simplicity and clarity.

You can perhaps address other required functions with a link that gives access to a separate form -- on a different page perhaps, or in a show/hide div situation, or even in an iframe. But whatever approach you use, to get a comfortable result you'll probably need to back up and change something that you've already assumed is a requirement. It's highly unlikely that you'll get the Enter key to work the way you would prefer.

Quagmire

7:41 pm on Jun 25, 2003 (gmt 0)

10+ Year Member



Thanks. I agree that the simplest approach is the best. I didn't think of the show/hide div trick, and that might work for me.