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]

Reply via email to