[hunchentoot-devel] form array

Tab Atkins Jr. jackalmage at gmail.com
Wed Jul 16 20:46:37 UTC 2008


On Wed, Jul 16, 2008 at 3:17 PM, Jens Teich <info at jensteich.de> wrote:

> Maybe this is only a problem of my wrong handling of html forms.
>
> I try to set up a group of checkboxes like this:
>
> <form action='test.html'>
>   <input type='checkbox' name='array[]'>
>   <input type='checkbox' name='array[]'>
>   <input type='checkbox' name='array[]'>
>   ...
>
> I try to get the user input into a Lisp array with an easy-handler but get
> only an empty array.


The name='array[]' syntax is useful in php which actually *uses* that sort
of syntax to assign values to an array, but the docs indicate that
hunchentoot requires you to actually specify a non-negative integer as the
index for the array value.  So, you would need to do something like
name="array[0]", name="array[1]", etc.

When clicking the submit button I see an URL like
>
>  test.html?array%5B%5D=on...
>
> where I expect
>
>  test.html?array[0]=on...
>
> If this is already my problem it has nothing to do with huchentoot, but I
> would appreciate any kind of help ...


There is absolutely nothing wrong with that.  The bracket characters aren't
allowed in a url, and so are url-encoded automagically by the browser.

~TJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20080716/77fafc15/attachment.html>


More information about the Tbnl-devel mailing list