Re: Several button "Submit"

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