W3C home > Mailing lists > Public > public-html@w3.org > May 2007

Re: Several button "Submit"

From: Elliott Sprehn <esprehn@gmail.com>
Date: Wed, 2 May 2007 13:20:51 -0400
Message-Id: <E85A8F7B-964A-4071-A23B-A9F71822BC6A@gmail.com>
Cc: public-html@w3.org
To: Dmitry Turin <html60@narod.ru>

On May 2, 2007, at 12:57 PM, Dmitry Turin wrote:

>
> Now <submit> has inscription, equal to sending value
> (equal to attribute "value").
> Sometimes it's necessary, that inscription and sending value will  
> be different.
>
> Let's add one more attribute "text",
> which will be displayed as inscription (if attribute is specified).
>
> <input type=submit name=task value=copy   text=operation1>
> <input type=submit name=task value=move   text=operation2>
> <input type=submit name=task value=delete text=operation3>
>
> Thus inscription "move" will be displayed on button,
> and "operation2" will be send to server.
>
>
> Dmitry Turin
> http://html6.by.ru
> http://sql4.by.ru
> http://computer2.by.ru
>
>

I'm not sure this qualifies as "degrading gracefully" since it opens  
the door for submit buttons with values that are meaningless to users.

ex. <input type="submit" value="{a:del,e:1}" text="Delete Entry">  
Contrived, I know, but it illustrates the problem.

Anyway, if you need to do different actions, as per your example,  
then you should really be doing

<input type=submit name=copy   value=Copy>
<input type=submit name=move   value=Move>
<input type=submit name=delete value=Delete>

And then checking for the existence of the submit button's name on  
the server to determine the action to take. If you need to submit  
some extra bit of information, use a hidden form field and just  
ignore it unless the correct submit button was used.

We also have <button> :)

- Elliott
Received on Wednesday, 2 May 2007 17:21:03 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:38:44 UTC