default submit button in multi-button form

A

Andrew Crowe

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
(e-mail address removed)
http://www.adaptivetechnologies.com
 
E

Ethan Schlenker

(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
 
J

Jukka K. Korpela

Ethan Schlenker said:
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.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top