default submit button in multi-button form

Discussion in 'HTML' started by Andrew Crowe, Feb 3, 2004.

  1. Andrew Crowe

    Andrew Crowe Guest

    Hi guys,

    I have a web form that currently looks like this:

    (Title) (Firstname) (Lastname) [Delete]
    (Title) (Firstname) (Lastname) [Delete]
    (Title) (Firstname) (Lastname) [Delete]
    [more...]

    [Save names]


    ()=text field
    []=button


    At the moment pressing return while in one of the text fields activates the
    [Delete] button next to it, which isn't a very good default behaviour. Is
    there any way to specify a default button? I'd like it to select the
    [more...] button to add a new row when return is pressed. (preferably
    without relying on JavaScript)

    --
    Regards,
    --
    Andrew Crowe
    Developer

    Adaptive Technologies Ltd
    13 Brunswick Square
    Hove
    East Sussex
    BN3 1EH
    UK

    01273 728128

    http://www.adaptivetechnologies.com
    Andrew Crowe, Feb 3, 2004
    #1
    1. Advertising

  2. > (Title) (Firstname) (Lastname) [Delete]
    > (Title) (Firstname) (Lastname) [Delete]
    > (Title) (Firstname) (Lastname) [Delete]
    > [more...]
    >
    > [Save names]
    >
    > At the moment pressing return while in one of the text fields activates

    the
    > [Delete] button next to it, which isn't a very good default behaviour. Is
    > there any way to specify a default button?


    Funny, I was just dealing with this last night :)

    To the best of my knowledge, it seems that pressing enter will activate the
    closest submit button that is "below" the current form item. I don't know
    of any tag to specify the default.

    However, I'd try experimenting with buttons (not submits, but
    type="button") that have javascript behind them (not your preferred
    solution), or perhaps using form images as the delete submits (not sure if
    they would get passed over), or alternately, make the delete button a link
    pointing to a script (delete.php?firstname=foo&lastname=bar).

    Just my .02.

    Ethan
    --
    Datarealm Internet Services, Inc.
    Shared Hosting: http://www.serve.com
    Dedicated Hosting: http://www.rackmounted.com
    Ethan Schlenker, Feb 4, 2004
    #2
    1. Advertising

  3. Ethan Schlenker <> wrote:

    > To the best of my knowledge, it seems that pressing enter will
    > activate the closest submit button that is "below" the current form
    > item.


    Such things often happen, unfortunately. But it is browser-dependent.

    > I don't know of any tag to specify the default.


    There isn't.

    The long story is at
    http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

    The short story is that if you can, avoid putting several submit
    buttons into a form. For example, instead of several "Delete" buttons,
    put checkboxes before each item that indicates a deletable entry, and
    include one "Delete marked items" button.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Feb 6, 2004
    #3
    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. Replies:
    2
    Views:
    6,160
  2. Network-Man
    Replies:
    5
    Views:
    78,188
    gaul1
    Jul 7, 2012
  3. Guest
    Replies:
    2
    Views:
    1,556
    Guest
    Oct 25, 2004
  4. Replies:
    2
    Views:
    336
  5. Replies:
    3
    Views:
    648
Loading...

Share This Page