If you look at the Form documentation, you will see that the Submit event
fires at the end of the submission - after any values from form fields have
been put into your TestPojo's.  Therefore, you are wiping out any changes at
the end of your submit.

You could set up the list in onPrepare().  Just make sure not to
re-initialized it unless that's what you really want.

Jonathan

> -----Original Message-----
> From: wesley [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 25, 2008 13:02
> To: users@tapestry.apache.org
> Subject: Re: append checkbox to grid list
> 
> 
> hi Marcelo,
> 
> 1.below is my simple.tml page:
> //simple.tml
> ---------------------------
> <t:form t:id="my">
>                       <input type="submit" value="submit"/>
>                       <br/>
>                       <t:grid t:id="simplegrid" t:source="testPojoList"
> row="tp" model="model">
>                                       <t:parameter name="subsCell">
>                                               <t:checkbox t:id="subs"
> t:value="tp.subs"/>
>                                       </t:parameter>
>                       </t:grid>
>       <t:actionLink t:id="checkPage">Next</t:actionLink>
> </t:form>
> 
> 2.This is Simple.java
> -----------------------------
> public class Simple {
>       @Persist
>       private List<TestPojo> testPojoList;
>       @Persist
>       private TestPojo tp;
> 
>       public List<TestPojo> getTestPojoList() {
>               return testPojoList;
>       }
> 
>       public void setTestPojoList(List<TestPojo> testPojoList) {
>               this.testPojoList = testPojoList;
>       }
> 
>       Object onSubmitFromMy(){
>               testPojoList = new ArrayList<TestPojo>();
>               for(int i = 0; i < 10; i++){
>                       TestPojo tp = new TestPojo();
>                       tp.setId("["+i+"]");
>                       tp.setName("Name"+i);
>                       tp.setDescription("description"+i);
>                       testPojoList.add(tp);
>               }
>               return null;
>       }
> 
>       Object onActionFromCheckPage(){
>               for(int i = 0; i < testPojoList.size(); i++){
>                       TestPojo tps = testPojoList.get(i);
>                       Pt.pt("id "+tps.getId()+" check "+tps.isSubs());
>               }
>               return null;
>       }
> 
>       public TestPojo getTp() {
>               return tp;
>       }
> 
>       public void setTp(TestPojo tp) {
>               this.tp = tp;
>       }
> }
> 
> 3. Lastly, the pojo class within the list
> --------------------------
> public class TestPojo {
>       private String id;
>       private String name;
>       private String description;
>       private boolean subs;
> 
>       public boolean isSubs() {
>               return subs;
>       }
>       public void setSubs(boolean subs) {
>               this.subs = subs;
>       }
>       public String getId() {
>               return id;
>       }
>       public void setId(String id) {
>               this.id = id;
>       }
>       public String getName() {
>               return name;
>       }
>       public void setName(String name) {
>               this.name = name;
>       }
>       public String getDescription() {
>               return description;
>       }
>       public void setDescription(String description) {
>               this.description = description;
>       }
> }
> 
> **the submit button is to get the list of TestPojo object
> **the actionlink is to call the actionmethod and loop through the list and
> print out the subs boolean property. but all false even if i checked
> enabled
> the checkbox.
> 
> hope to receive your advise soon. thanks
> 
> wesley
> 
> 
> 
> Marcelo Lotif wrote:
> >
> > Can you attach your source code?Just to be sure, check if you are
> binding
> > it
> > to a valid boolean property and if this property is also marked with
> > @Persist - at least "flash".
> >
> > On Thu, Sep 25, 2008 at 7:28 AM, wesley <[EMAIL PROTECTED]> wrote:
> >
> >>
> >> hi all,
> >>
> >> i'm having a difficulties to append additional column in grid. when i
> >> append
> >> the extra column within the grid model as a checkbox, the class behind
> it
> >> couldn't track the checkbox's state (check or unchecked).
> >>
> >> Is there a special way to implement this? hope to have a pointer and
> >> advise
> >> from anyone.
> >>
> >> Thanks & Regards,
> >> Wesley
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/append-checkbox-to-grid-list-
> tp1117613p1117613.html
> >> Sent from the Tapestry Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> > --
> > Atenciosamente,
> >
> > Marcelo Lotif
> > Programador Java e Tapestry
> > FIEC - Federação das Indústrias do Estado do Ceará
> > (85) 3477-5910
> >
> >
> 
> --
> View this message in context: http://n2.nabble.com/append-checkbox-to-
> grid-list-tp1117613p1118670.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to