I don't know if this is the right thread.  But I just got multibox working
in my app (including preservation of checkbox entries between forwards).
Let me share with you what I have to see if this helps:

in Jsp: (cleanSolutionAreaTypes in an Application-scoped Vector)
        <tr>
        <td align="left">
        Solutions Area*
        </td>
        <td align="left">
        <logic:iterate id="solutionAreaType" name="cleanSolutionAreaTypes">
        <html:multibox property="solutionAreaTypes">
        <bean:write name="solutionAreaType" property="id"/>
        </html:multibox>
        <bean:write name="solutionAreaType" property="name"/><br>
        </logic:iterate>
        </td>
        </tr>

in Form:
    protected String[] solutionAreaTypes = new String[0];

    public String[] getSolutionAreaTypes()
    {
        return solutionAreaTypes;
    }

    public void setSolutionAreaTypes(String[] solutionAreaTypes)
    {
        this.solutionAreaTypes = solutionAreaTypes;
    }

What was causing me some exceptions was this.  I originally used another
application-scoped vector called "solutionAreaTypes" for other purposes
(like drop-down lists).  That Vector contains an entry that has a null ID
value (eg. name = "--specify--" value="").  This was causing Struts to throw
a non-intuitive exception.  I then created another Vector without this entry
in it and everything seems to work fine now.  Of course I've only gotten it
to work about 15 minutes ago so I'll let you know later if it really works
;-)

- jeff

----- Original Message -----
From: "Peter Alfors" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 2:01 PM
Subject: Re: Checkbox Arrays


> Try pulling the bean value out into a script variable.
> Taglibs cannot be nested within another taglib as an attribute.
>
>
> Tony Karas wrote:
>
> > Yeah - I'm looking at that.  My problem now is how to get the value for
each
> > checkbox.  My bean has an "id" property - so I have tried this kind of
> > thing:
> >
> > <logic:iterate id="retailer" name="retailerForm" property="retailers">
> >         <tr>
> >         <td><html:checkbox name="retailer" property="delete"
value="<bean:write
> > name="retailer" property="id"/>"/></td>
> >         <td><bean:write name="retailer" property="id"/></td>
> >         <td><html:text name="retailer" property="name"/></td>
> >         </tr>
> > </logic:iterate>
> >
> > But it doesn't like having the bean:write embedded there.  Am I missing
> > something obvious?
> >
> > Many thanks
> > Tony
> >
> > >From: Peter Alfors <[EMAIL PROTECTED]>
> > >Reply-To: [EMAIL PROTECTED]
> > >To: [EMAIL PROTECTED]
> > >Subject: Re: Checkbox Arrays
> > >Date: Thu, 10 May 2001 11:09:18 -0500
> > >
> > >Im not sure how the ActionForm changes things, but without an
actionform
> > >your
> > >could do this....
> > >
> > >Each checkbox can have the same name, but a different value.
> > >When the form is submitted, the checkboxes that have been checked are
in
> > >the
> > >request.
> > >You can use the request.getParameterValues("checkBoxName") to retrieve
a
> > >string
> > >array of the values for the checked boxes.
> > >
> > >HTH,
> > >     Pete
> > >
> > >Tony Karas wrote:
> > >
> > > > Can anyone help with this?
> > > >
> > > > I have an array of checkboxes in my ActionForm represented by
> > > >
> > > > boolean[] delete;
> > > >
> > > > and I have a setter function
> > > >
> > > > public void setDelete( boolean[] values )
> > > > {
> > > >         delete = values;
> > > > }
> > > >
> > > > The problem is that I have only checkboxes that are checked get sent
> > >back -
> > > > so if one checkbox is checked all I get is an array of length 1.
> > >Therefore,
> > > > it is not possible for me to determine which checkbox has been
checked.
> > > >
> > > > In the documentation it tells me to use reset() in ActionForm to
> > >initialise
> > > > the values - but this will only work with single checkboxes and not
> > >arrays.
> > > >
> > > > I think I'm stuck.  Is there anyway I can determine which checkbox
has
> > >been
> > > > checked - maybe I can get the value to differ for each checkbox.
Will
> > >look
> > > > in to that.
> > > >
> > > > Cheers
> > > > Tony
> > ><< peter.alfors.vcf >>
> >
> >
_________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com.
>

Reply via email to