WebKit handles this the same way as Python's cgi module.  You get a string
if one checkbox is selected, or a list of strings if two or more checkboxes
are selected.

I have a method like this in my SitePage (base class for all of my servlets)
that I use to get list fields:

        def listField(self, field):
                value = self.request().field(field, [])
                if not isinstance(value, types.ListType):
                        value = [value]
                return value

There has been discussion in the past about adding something like this into
WebKit, but it hasn't happened yet (probably because it's so easy to just
add a method like this into your SitePage).

- Geoff

> -----Original Message-----
> From: Brett Funderburg [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 21, 2002 6:52 PM
> To: [EMAIL PROTECTED]
> Subject: [Webware-discuss] Getting INPUT form array elements
> 
> 
> I have an html form similar to the following
> 
> <form>
> <input type="checkbox" name="item[]" value="1">1
> <input type="checkbox" name="item[]" value="10">10
> <input type="checkbox" name="item[]" value="100">100
> </form>
> 
> I'm seeing the following behavior when the form is submitted:
>  - if one item is checked,
>       len(self.request().value('items[]') is equal to the 
> length of the
>       string in 'value'; i.e. it is not being carried over as 
> an array/list.
>       I would expect the number 1 to be the output from the 
> statement above
> 
>  - if more than one item is checked,
>       len(self.request().value('items[]') is (correctly) equal to
>       the number of elements in the list.
> 
> It makes no difference whether the form submit method is GET or POST.
> 
> What is the correct way to deal with INPUT arrays so that 
> their consistency
> is maintained regardless of whether one or more than one item 
> is submitted.
> 
> I'm using mod_webkit with the SetHandler directive on Apache 
> 1.3.23 (and
> Mozilla 1.0 on the client side)
> 
> brett
> 
> 
> 
> 
> 
> -------------------------------------------------------
> Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> 


-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to