[hunchentoot-devel] How do I read the submit button value?

Tab Atkins Jr. jackalmage at gmail.com
Mon Oct 18 16:29:41 UTC 2010


On Sat, Oct 16, 2010 at 9:43 AM, Andrea Chiumenti <kiuma72 at gmail.com> wrote:
> 2010/10/16 Tab Atkins Jr. <jackalmage at gmail.com>:
>> On Sat, Oct 16, 2010 at 9:13 AM, Andrea Chiumenti <kiuma72 at gmail.com> wrote:
>>> Matt,
>>> don't use <input type='submit'
>>>
>>> it's old java  Struts 1.2 style, bleah.. and typical of old MVC action
>>> based frameworks.
>>>
>>> use <button> intead.
>>
>> This makes no sense.  <input type=submit value=foo> is identical to
>> <button type=submit>foo</button> in terms of submission behavior.
>> It's also usually identical in default appearance.  There's not
>> intended to be any difference between them.  There is certainly no
>> difference in terms of style or framework.
>>
>> The OP's problem is that an input needs a 'name' attribute to be
>> included in the submitted data.  A submit button without a 'name'
>> attribute will still submit the form, but won't place its value in the
>> data, so you can't tell which button was used to submit it.
>
> before saying to someone that he says nonsense!!!!
>
> I'll give you this example, without comments. Make your conclusions!
>
> <html>
>  <head>
>    <title>Think before</title>
>  </head>
>  <body>
>    <form action="#" method="get">
>      <button name="submit" value="action1" type="submit">esegui
> operazione</button>
>      <button name="submit" value="action2" type="submit">cancella
> tutti i dati</button>
>    </form>
>  </body>
> </html>

As Ralf said, I was commenting specifically on your statement that
<input type=submit> was somehow "old style" or related to java or
certain frameworks.  That is indeed nonsense; <input type=submit> has
absolutely nothing to do with frameworks or particular programming
languages.

Yes, with <input type=submit> the label and the submit value are the
same, while they can be different things with <button type=submit>.
That has nothing to do with frameworks.  It certainly has nothing to
do with the OP's problem, which was that his submit button didn't have
a 'name' attribute, and thus wasn't being submitted with the form.

~TJ




More information about the Tbnl-devel mailing list