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: [email protected] 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) { > Collection<Contact> contactList = > (Collection<Contact>) 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]
