You might like  to check out the example at 

http://lombok.demon.co.uk/tapestry5Demo/test/components/checkboxgroupdemo


Shing




--- On Tue, 19/5/09, mark99 <m...@vexeddigital.com> wrote:

> From: mark99 <m...@vexeddigital.com>
> Subject: Checkboxes within a loop in a form
> To: users@tapestry.apache.org
> Date: Tuesday, 19 May, 2009, 1:11 AM
> 
> Hi
> 
> I've got a problem implementing a form which renders
> checkboxes within a
> loop, and then posts back the values of the checkboxes on
> form submission.
> In my form submission handler, I need to know which
> checkboxes the user
> checked.
> 
> What I'm looking to do is something like this:
> 
> Page:
> 
> <t:form>
> <t:loop source="choices" value="choice">
>   <t:checkbox t:value="choice"/>
> </t:loop>
> <t:submit/>
> </t:form>
> 
> 
> Class:
> 
> void onSubmit() {
>   for(boolean b : choices)
>     System.out.println(b);
> }
> 
> 
> Where 'choices' is a List of booleans.
> 
> If I put @Persist on 'choices', the list is still null on
> postback, which I
> expected. If I re-initialize the list on postback that
> doesn't help either
> as I've lost the results from the form.
> 
> So what is the solution for doing this type of thing?
> 
> Thanks, Mark
> -- 
> View this message in context: 
> http://www.nabble.com/Checkboxes-within-a-loop-in-a-form-tp23601662p23601662.html
> Sent from the Tapestry - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to