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: [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]






      
____________________________________________________________________________________
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]

Reply via email to