<< And then in your onSuccess() and/or onValidate() event handler method, you can inject the Request get get the selectedObjects query parameter value.
>> Have you got sample code about this ? Regards. --- En date de : Lun 29.3.10, Howard Lewis Ship <hls...@gmail.com> a écrit : De: Howard Lewis Ship <hls...@gmail.com> Objet: Re: Persist value of checkbox ? À: "Tapestry users" <users@tapestry.apache.org> Date: Lundi 29 mars 2010, 18h45 On Mon, Mar 29, 2010 at 9:14 AM, Thiago H. de Paula Figueiredo <thiag...@gmail.com> wrote: > On Mon, 29 Mar 2010 13:10:15 -0300, jaques robert > <mondes_englou...@yahoo.fr> wrote: > >> Hello, > > Hi! > >> I've tried this code which present 10 checkbox which I submit. Then I go >> back to this page so I'd like those checkbox to be ticked if they were >> ticked before. >> >> <t:Loop source="1..10" value="index"> >> <input t:type="checkbox" t:id="pute" /> >> </t:Loop> >> >> So in my class I've coded : >> �...@persist >> �...@property >> private boolean _pute; > > You should have a list of booleans, not a single one. To amplify here, Tapestry is doing what you told it to. It renders 10 checkboxes, each of which draws its initial value from the _pute field (and pute property). On submit, it does the exact same thing: reads the query parameter for each checkbox (they get rendered with unique name attributes) and updates the pute property. However, since there's 10 checkboxes and only one property, it ends up with the 10th checkbox's value. I teach, in my labs, a way to use a synthetic property to populate a Set with value selected by checkboxes .... but you could just as easily use ordinary HTML <input type="checkbox">, assign your own name and use a value (typically a database persistent entity id) of your own devising: <t:loop source="databaseObjects" value="object"> <input type="checkbox" name="selectedObjects" value="${object.id}"/> ... </t:loop> And then in your onSuccess() and/or onValidate() event handler method, you can inject the Request get get the selectedObjects query parameter value. I call this "dropping down to Servlets mode" and it is appropriate in cases where a full-bore Tapestry component solution is more work. > > >> private Object onSuccess() { >> // call database update >> return this; >> } > > Return null instead. > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and > instructor > Owner, software architect and developer, Ars Machina Tecnologia da > Informação Ltda. > http://www.arsmachina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org