Focus and priorities in forms

Discussion in 'HTML' started by Matthias Braun, Feb 16, 2010.

  1. 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
     
    Matthias Braun, Feb 16, 2010
    #1
    1. Advertising

  2. Matthias Braun

    rf Guest

    "Matthias Braun" <> wrote in message
    news:4b7a3d34$0$7618$-online.net...
    > 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>
     
    rf, Feb 16, 2010
    #2
    1. Advertising

  3. Matthias Braun

    Kiran Makam Guest

    > 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
    -----
    <input type="button" value="Cancel" name="UserPasswordCancel" />
    ----

    - Kiran Makam
     
    Kiran Makam, Feb 16, 2010
    #3
  4. Matthias Braun

    Doug Miller Guest

    In article <>, Kiran Makam <> wrote:
    >> 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
    >-----
    ><input type="button" value="Cancel" name="UserPasswordCancel" />
    >----


    Or a reset button:
    <input type="reset" value="Cancel" name="UserPasswordCancel" />
     
    Doug Miller, Feb 16, 2010
    #4
  5. Matthias Braun wrote:

    > 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.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Feb 16, 2010
    #5
  6. Thanks - if there is no other option I will remove the cancel button.
    Somehow a gap in HTML specification.

    Cheers,

    Matthias

    Jukka K. Korpela wrote:
    > Matthias Braun wrote:
    >
    >> 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.
    >
     
    Matthias Braun, Feb 17, 2010
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sebastian Millies

    SwingWorker and inherited thread priorities

    Sebastian Millies, Sep 12, 2005, in forum: Java
    Replies:
    5
    Views:
    2,364
    Thomas Hawtin
    Sep 12, 2005
  2. Soren Kuula
    Replies:
    2
    Views:
    577
    Malcolm Dew-Jones
    Apr 13, 2005
  3. Replies:
    4
    Views:
    502
  4. Roger
    Replies:
    3
    Views:
    359
  5. RgeeK
    Replies:
    5
    Views:
    160
    Jorge
    Jul 12, 2008
Loading...

Share This Page