You are here: Re: How do I stop link a Text input to a Submit button? « HTML « IT news, forums, messages
Re: How do I stop link a Text input to a Submit button?

Posted by Alan J. Flavell on 07/13/06 10:59

On Thu, 13 Jul 2006, Jukka K. Korpela wrote:

> Robert S <robert.spam.me.senseless@gmail.com> scripsit:
>
> > I have a rather large page with an arbitrary number of "submit"
> > buttons. When a user enters something in a Text field and presses
> > the "Enter" key, the wrong action occurs (usually the "Delete" key
> > gets pressed!).

Is the "Delete" key your first submit button?

> This is a special case (and apparently a particularly nasty case) of
> the problem "how do I prevent a form from being submitted when the
> user hits Enter?". The answer is, more or less, "You don't; cope
> with it when it happens".

I'll go along with that...

> See http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

thanks...

> The safe, though sometimes a bit clumsy, approach is that you don't
> have several submit buttons (when the form contains at least one
> text input field).

Right. However, to the best of my recollection (see my web page for
details, though), *if* the form is submitted in this way, *and* the
focus is not on one of the submit controls, then one of the following
happens:

1 - No name=value attribute corresponding to a submit control is sent

2 - The name=value attribute corresponding to the *first* submit
control is sent.

The first case should be easy to deal with.

The second one can be handled by making the first submit control
be something harmless, such as "Preview".

> This means that you don't have, say, "Delete", "Add" and "Change"
> submit buttons. Instead, you have e.g. radio buttons for selecting
> the action to be made, with such values, and a single submit button.

It's a reasonable option, indeed. But the other approach can be
slightly more convenient for the user, and I don't recall any browser
on which it causes problems.

cheers

(Excuse the pedantry with referring to "submit controls", but I'm
always worried about possible confusion with <input type=button> and
<button> when one's talking about "buttons".)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация