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

Andrea Chiumenti kiuma72 at gmail.com
Sun Oct 17 13:58:26 UTC 2010


Matt,
I'm trying to guess what you are doing.

Hans has show you the functions you have to use and told you why you
didn't get any value for the submit button, because you forgot the
name attribute inside the input of type 'submit'.

Having said that, I think, but maybe I'm wrong, that you are planning
to have two submit buttons inside your page and then decide which
action to call depending on the button the user hits.

If you are going to use <input type='submit' ... you will bind your
action choices on button labels, this because with input/submit the
value is also the label.

If, instead, you are going to use <button> tag you may use value as
submission parameter, but you can have the description you want for it
(you may consider to decorate button label as well).
Using button your action/parameter will not suffer of the i18n 'problem'.
You'll also gain more eye-candy because you'll be able to do something like

<button name="submit" type="submit" value="action1"><span
class="bold">Delete</span> all</button>

So input/submit and button/submit are only apparently identical.

Cheers,
kiuma





2010/10/16 Andrea Chiumenti <kiuma72 at gmail.com>:
> 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>
>
> kiuma
> 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.
>>
>> ~TJ
>>
>> _______________________________________________
>> tbnl-devel site list
>> tbnl-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>




More information about the Tbnl-devel mailing list