Focus and priorities in forms

M

Matthias Braun

Hi,

I have a form using two submit buttons:

<form action ...

<input type="submit" value="Cancel" name="UserPasswordCancel" />
<input type="submit" value="Submit" name="UserPasswordSubmit" />
....
</form>

Works fine! Now, if I type in the entries and hit just ENTER, the first
submit will be execute (UserPasswordCancel). How can I modify my page so
that the second button has the "focus" (UserPasswordSubmit)?

Thanks,

Mattihas
 
R

rf

Matthias Braun said:
Hi,

I have a form using two submit buttons:

<form action ...

<input type="submit" value="Cancel" name="UserPasswordCancel" />
<input type="submit" value="Submit" name="UserPasswordSubmit" />
...
</form>

Works fine! Now, if I type in the entries and hit just ENTER, the first
submit will be execute (UserPasswordCancel). How can I modify my page so
that the second button has the "focus" (UserPasswordSubmit)?


<form action ...

<input type="submit" value="Submit" name="UserPasswordSubmit" />
<input type="submit" value="Cancel" name="UserPasswordCancel" />
....
</form>
 
K

Kiran Makam

How can I modify my page so
that the second button has the "focus" (UserPasswordSubmit)?

If 'Cancel' button is not submitting any thing, you can make it as a
normal button
 
D

Doug Miller

If 'Cancel' button is not submitting any thing, you can make it as a
normal button

Or a reset button:
<input type="reset" value="Cancel" name="UserPasswordCancel" />
 
J

Jukka K. Korpela

Matthias said:
I have a form using two submit buttons:

Consider rethinking or redesigning.
<form action ...

<input type="submit" value="Cancel" name="UserPasswordCancel" />
<input type="submit" value="Submit" name="UserPasswordSubmit" />
...
</form>

Works fine!

No it doesn't, as your question indicates. It's confusing and pointless.
Just omit the "Cancel" button. If someone doesn't want to log in, he just
won't. No need to click on any button for that. And don't replace it by a
destruct data button, called "reset" button - in a very simple form that
takes little user input, it does not cause great damage, but neither does it
do any good. It's just an annoyance and a pointless risk: when the user
accidentally hits it, he causes something he didn't mean.
Now, if I type in the entries and hit just ENTER, the
first submit will be execute (UserPasswordCancel).

Maybe. Perhaps even commonly. This is one of the reasons why your page does
not work fine.
How can I modify
my page so that the second button has the "focus"
(UserPasswordSubmit)?

You can't, in any reliable way. And it's not a matter of focus at all.
 
M

Matthias Braun

Thanks - if there is no other option I will remove the cancel button.
Somehow a gap in HTML specification.

Cheers,

Matthias
 

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,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top