Something else to add to the docs ;-)
>>> [EMAIL PROTECTED] 2004/11/06 02:28:21 PM >>>
Hi Andrew,
not sure about this but cocoon behaves the following way for multiple
checkboxes:
- if no checkbox is selected, you get no value, i.e.
cocoon.request.get("delItem") is null.
- if one checkbox is selected, you get a simple value, i.e.
cocoon.request.get("delItem") is for example "5".
- if two or more checkboxes are selected, you get an instance of
java.util.List
Only in the latter case you can use the iterator function. In the first
two cases, items.iterator() will
be undefined. So you should actually do some pre-processing like this
to
have a list in any case:
var items = new java.util.Vector();
if(cocoon.request.get("delItem"))
if(cocoon.request.get("delItem").iterator) // no brackets, this
just
checks if it has an iterator at all
items.addAll(cocoon.request.get("delItem"));
else
items.add(cocoon.request.get("delItem"));
This is a little nasty sometimes, but I guess it can't be implemented
differently in cocoon.
HTH,
Johannes
beyaNet wrote:
> Hi,
> I have an html form which has a number of checkboxes which when
> selected indicate that the item should be deleted from an order. All
> the checkboxes share the same name, delItem. So when the form is
> submitted and depending on the number of items I have selected to be
> deleted, what gets posted in the form should be an array of
delItems:
>
> [val1, val2, val3]
>
> So, in my flowscript which checks this value i do:
>
> var items = cocoon.request.get("delItem");
>
> var iterator = items.iterator();
>
> I then get an error message saying that iterator is not a function.
> What am I doing wrong here?
>
> many thanks
>
> Andrew
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]