How to make a specific 'submit' button the default?

M

Martin

I have a page/form with several text boxes and several submit buttons.
I would like to have a script that would set one of the buttons as the
'default' when the text in any of several specific text boxes is
changed by the user. 'Default' meaning that's the one that will react
when the user hits the <Enter> key.

I read a message on another board that setting a submit button as the
default is not possible - is that true?
 
J

Jukka K. Korpela

Martin said:
I have a page/form with several text boxes and several submit buttons.
I would like to have a script that would set one of the buttons as the
'default' when the text in any of several specific text boxes is
changed by the user.

How would that help, given the fact that scripting can be disabled, and
often is?

The only safe way to avoid the problems caused by browsers' foolish
behavior in this respect is to use only one submit button if you have
text input fields in a form. Use e.g. radio buttons to let the user make
the selection between the alternatives that the multiple submit buttons
represent in your current design. That is, the user would just select an
action by selecting among radio buttons, then use the single submit
button to submit the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top