Within a form, it's my understanding there can be more than one "submit" button, varying by their "value" attribute. Various pointers for this on the web explain how to determine which value was posted.
How can I obtain this value via Hunchentoot?
Thanks, Matt
Matt,
you can use the GET-PARAMETERS*/POST-PARAMETERS* functions to get a list of all parameters (GET/POST respectively). Also, the easy handler architecture allows your handler to receive a list of all parameter values for parameters with the same name, please check out the documentation for DEFINE-EASY-HANDLER.
-Hans
On Sat, Oct 16, 2010 at 12:49 PM, Matt Lamari matt.lamari@gmail.com wrote:
Within a form, it's my understanding there can be more than one "submit" button, varying by their "value" attribute. Various pointers for this on the web explain how to determine which value was posted.
How can I obtain this value via Hunchentoot?
Thanks, Matt
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
I tried to strip the example down, the HTML is below
For post-parameters* and get-parameters* I get the following:
Get Parameters: NIL
Post Parameters: (("(Quantity)" . ""))
Is there something wrong with the html that prevents the submit value from coming through too?
<form method='post' action='/AddNewProductInstance'> <table border='1'><tr><td>Quantity</td><td><input name='(Quantity)' type='text' cols='40' value='' constraints='{}' required='true' /></td></tr> </table> <input type='submit' value='SubmitButton' /></form>
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.
kiuma
2010/10/16 Matt Lamari matt.lamari@gmail.com:
I tried to strip the example down, the HTML is below
For post-parameters* and get-parameters* I get the following:
Get Parameters: NIL
Post Parameters: (("(Quantity)" . ""))
Is there something wrong with the html that prevents the submit value from coming through too?
<form method='post' action='/AddNewProductInstance'> <table border='1'><tr><td>Quantity</td><td><input name='(Quantity)' type='text' cols='40' value='' constraints='{}' required='true' /></td></tr> </table> <input type='submit' value='SubmitButton' /></form>
tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
On Sat, Oct 16, 2010 at 9:13 AM, Andrea Chiumenti kiuma72@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
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@gmail.com:
On Sat, Oct 16, 2010 at 9:13 AM, Andrea Chiumenti kiuma72@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@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
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@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@gmail.com:
On Sat, Oct 16, 2010 at 9:13 AM, Andrea Chiumenti kiuma72@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@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel
On Sat, Oct 16, 2010 at 9:43 AM, Andrea Chiumenti kiuma72@gmail.com wrote:
2010/10/16 Tab Atkins Jr. jackalmage@gmail.com:
On Sat, Oct 16, 2010 at 9:13 AM, Andrea Chiumenti kiuma72@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
Matt,
your second input has no name.
-Hans
On Sat, Oct 16, 2010 at 6:05 PM, Matt Lamari matt.lamari@gmail.com wrote:
I tried to strip the example down, the HTML is below
For post-parameters* and get-parameters* I get the following:
Get Parameters: NIL
Post Parameters: (("(Quantity)" . ""))
Is there something wrong with the html that prevents the submit value from coming through too?
<form method='post' action='/AddNewProductInstance'> <table border='1'><tr><td>Quantity</td><td><input name='(Quantity)' type='text' cols='40' value='' constraints='{}' required='true' /></td></tr> </table> <input type='submit' value='SubmitButton' /></form>