[hunchentoot-devel] multiple POST/GET values

Zach Beane xach at xach.com
Mon Jul 21 19:04:14 UTC 2008


On Mon, Jul 21, 2008 at 08:54:41PM +0200, Jaap de Heer wrote:
> Howdy,
> 
> I ran into trouble with Hunchentoot trying to process the result
> of a form containing a select multiple:
> <select multiple name="foo-or-bar">
>   <option value="foo">Foo
>   <option value="bar">Bar
> </select>
> 
> The user can select both foo and bar, which results in both being
> submitted.
> In the POST request, this looks something like:
> "other-field-1=x&foo-or-bar=foo&foo-or-bar=bar&other-field-2=x"
> 
> Hunchentoot will pick up on only one of them, i.e.
> (get-post-parameter "foo-or-bar") will be either "foo" or
> "bar" but not both; it should be both.

I disagree (though I'm not sure exactly what you mean by
GET-POST-PARAMETER, which isn't a part of Hunchentoot I've ever
seen). If you need multiple parameter values for a given name, you can
pick them out of the POST-PARAMETERS alist easily enough:

  (defun post-parameters (name)
    (let ((alist (tbnl:post-parameters)))
      (loop for ((key . value)) on alist
            when (string= key name) collect value)))

Zach



More information about the Tbnl-devel mailing list