Re: binding problem :(
Actually when I do the form.getModelObject() the debugger shows that it added a nestedModel. Model:classname=[org.apache.wicket.model.CompoundPropertyModel]:nestedModel=[[false, false]] -- The only constant in life is change. - Original Message From: Martijn Dashorst [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 11:42:26 PM Subject: Re: binding problem :( Do you use an item reuse strategy for the repeater? Martijn On 1/25/08, Beyonder Unknown [EMAIL PROTECTED] wrote: I think for some reason, when I submit, it overrides the model in the form. and when I do form.getModelObject() it returns a wrong value. I'm suspecting that its in the bind part of my populateItem(). I don't know why though. Best, Wen Tong -- The only constant in life is change. - Original Message From: Timo Rantalaiho [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 8:01:57 PM Subject: Re: binding problem :( On Thu, 24 Jan 2008, Beyonder Unknown wrote: For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) How you do submit the form? Are there validation errors? Remember that aonly after successful validation and submit the form and FormComponents get their models updated with values from the browser. I don't know if you need to use CheckGroup. I never used it, just CheckBoxes. IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } There is something strange here as Collection shouldn't have isSelected(). The isEmpty() call is also redundant. And just clicking a link doesn't submit the form, you should either submit the form (for example with AjaxFormSubmittingBehavior) or process your check box FormComponents manually (probably AjaxFormComponentUpdatingBehavior is needed to get the values to server). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations Oy URL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0 Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: binding problem :(
Hi Martjin, No. I don't know about item resuse strategy. Thanks, Wen Tong -- The only constant in life is change. - Original Message From: Martijn Dashorst [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 11:42:26 PM Subject: Re: binding problem :( Do you use an item reuse strategy for the repeater? Martijn On 1/25/08, Beyonder Unknown [EMAIL PROTECTED] wrote: I think for some reason, when I submit, it overrides the model in the form. and when I do form.getModelObject() it returns a wrong value. I'm suspecting that its in the bind part of my populateItem(). I don't know why though. Best, Wen Tong -- The only constant in life is change. - Original Message From: Timo Rantalaiho [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 8:01:57 PM Subject: Re: binding problem :( On Thu, 24 Jan 2008, Beyonder Unknown wrote: For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) How you do submit the form? Are there validation errors? Remember that aonly after successful validation and submit the form and FormComponents get their models updated with values from the browser. I don't know if you need to use CheckGroup. I never used it, just CheckBoxes. IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } There is something strange here as Collection shouldn't have isSelected(). The isEmpty() call is also redundant. And just clicking a link doesn't submit the form, you should either submit the form (for example with AjaxFormSubmittingBehavior) or process your check box FormComponents manually (probably AjaxFormComponentUpdatingBehavior is needed to get the values to server). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations Oy URL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0 Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
binding problem :(
Hi All, For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) Is there something missing? Here's the scenario: CompoundPropertyModel compoundPropertyModel = new CompoundPropertyModel(detachableModel); final Form myform = new Form(formId,compoundPropertyModel); CheckGroup checkGroup = new CheckGroup(checkGroup,compoundPropertyModel); checkGroup.add(new CheckGroupSelector(groupSelector)); SortableDataProvider dp = new SortableContactDataProvider(); DataView dataView = new DataView(contacts,dp) { ... protected void populateItem(Item item) { Contact contact = (Contact) item.getModelObject(); item.setModel(new CompoundPropertyModel(contact)); item.add(new Check(selected) ); } }; checkGroup.add(dataView); myForm.add(checkGroup); IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } }' myForm.add(link); Thanks for the help! Any suggestions/comments will be greatly appreciated! Best, Wen Tong -- The only constant in life is change. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: binding problem :(
On Thu, 24 Jan 2008, Beyonder Unknown wrote: For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) How you do submit the form? Are there validation errors? Remember that aonly after successful validation and submit the form and FormComponents get their models updated with values from the browser. I don't know if you need to use CheckGroup. I never used it, just CheckBoxes. IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } There is something strange here as Collection shouldn't have isSelected(). The isEmpty() call is also redundant. And just clicking a link doesn't submit the form, you should either submit the form (for example with AjaxFormSubmittingBehavior) or process your check box FormComponents manually (probably AjaxFormComponentUpdatingBehavior is needed to get the values to server). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: binding problem :(
Hi Timo, Thanks for the insight. I have to use CheckGroup, because i have to provide a check all/uncheck all checkbox. I got a typo there, the isSelected() is supposed to be part of Contact. And you're right, the isEmpty() is redundant if I use the for-each type loop. That's a remnant of the old code I tried earlier. I changed the AjaxLink to AjaxButton, and when I inspect the form in my debugger, it holds the model, and a list of boolean. Thanks, Wen Tong -- The only constant in life is change. - Original Message From: Timo Rantalaiho [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 8:01:57 PM Subject: Re: binding problem :( On Thu, 24 Jan 2008, Beyonder Unknown wrote: For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) How you do submit the form? Are there validation errors? Remember that aonly after successful validation and submit the form and FormComponents get their models updated with values from the browser. I don't know if you need to use CheckGroup. I never used it, just CheckBoxes. IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } There is something strange here as Collection shouldn't have isSelected(). The isEmpty() call is also redundant. And just clicking a link doesn't submit the form, you should either submit the form (for example with AjaxFormSubmittingBehavior) or process your check box FormComponents manually (probably AjaxFormComponentUpdatingBehavior is needed to get the values to server). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations Oy URL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: binding problem :(
I think for some reason, when I submit, it overrides the model in the form. and when I do form.getModelObject() it returns a wrong value. I'm suspecting that its in the bind part of my populateItem(). I don't know why though. Best, Wen Tong -- The only constant in life is change. - Original Message From: Timo Rantalaiho [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 8:01:57 PM Subject: Re: binding problem :( On Thu, 24 Jan 2008, Beyonder Unknown wrote: For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) How you do submit the form? Are there validation errors? Remember that aonly after successful validation and submit the form and FormComponents get their models updated with values from the browser. I don't know if you need to use CheckGroup. I never used it, just CheckBoxes. IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } There is something strange here as Collection shouldn't have isSelected(). The isEmpty() call is also redundant. And just clicking a link doesn't submit the form, you should either submit the form (for example with AjaxFormSubmittingBehavior) or process your check box FormComponents manually (probably AjaxFormComponentUpdatingBehavior is needed to get the values to server). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations Oy URL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: binding problem :(
Do you use an item reuse strategy for the repeater? Martijn On 1/25/08, Beyonder Unknown [EMAIL PROTECTED] wrote: I think for some reason, when I submit, it overrides the model in the form. and when I do form.getModelObject() it returns a wrong value. I'm suspecting that its in the bind part of my populateItem(). I don't know why though. Best, Wen Tong -- The only constant in life is change. - Original Message From: Timo Rantalaiho [EMAIL PROTECTED] To: users@wicket.apache.org Sent: Thursday, January 24, 2008 8:01:57 PM Subject: Re: binding problem :( On Thu, 24 Jan 2008, Beyonder Unknown wrote: For some reason, my checkbox doesn't bind to my model. I have a DataView that contains the Check component, and in my button, onClick, I use form.getModelObject(), but the objects doesn't get set. (Earlier than this, I tried AjaxButton and the form.getModelObject() returns an array of boolean) How you do submit the form? Are there validation errors? Remember that aonly after successful validation and submit the form and FormComponents get their models updated with values from the browser. I don't know if you need to use CheckGroup. I never used it, just CheckBoxes. IndicatingAjaxLink link = IndicatingAjaxLink(link) { @SuppressWarnings(unchecked) @Override public void onClick(AjaxRequestTarget target) { CollectionContact contactList = (CollectionContact) form.getModelObject(); if(contactList != null !contactList.isEmpty()) { for(ContactWrapper contactWrapper: contactList) { System.out.println(contact selected: + contactList.isSelected() ); } } There is something strange here as Collection shouldn't have isSelected(). The isEmpty() call is also redundant. And just clicking a link doesn't submit the form, you should either submit the form (for example with AjaxFormSubmittingBehavior) or process your check box FormComponents manually (probably AjaxFormComponentUpdatingBehavior is needed to get the values to server). Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations Oy URL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.0 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0