But another way to look at it is this: When a checkbox is unchecked, it has
a value of "unchecked".  Therefore, if you setRequired=true on a checkbox,
it's always satisfied.  In otherwords, a checkbox always has a value so
setRequired=true has no effect on a checkbox.  

-----Original Message-----
From: Kent Tong [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 07, 2008 2:07 AM
To: users@wicket.apache.org
Subject: "required" for Checkbox


Hi,

I observed that if "required" is set to true for a Checkbox, Wicket will
ensure that the Checkbox is checked. If it is cleared by the user, it
will be treated as an error. See 
https://issues.apache.org/jira/browse/WICKET-1221 and
https://issues.apache.org/jira/browse/WICKET-1260 for some
background.

For me, "required" means that a value must be provided. For a 
check box, if it is checked, it has a value of true. if it is unchecked, it 
has a value of false. So it always satisfy "required". Treating "required" 
as "having a value of true" doesn't sound correct to me.

If we consider the error message that should be used, for the case of
forcing the user to check the box (eg, [x] I have read the agreement), 
it should say "you must check xxx", which is quite different from the 
error message for "required": "you must provide xxx".

For the use case of forcing a checked check box, I think an CheckedValidator

should be used, which can provide a much better default error message.

Not that it's an important, but just to see what others think.

-----
--
Kent Tong
Wicket tutorials freely available at http://www.agileskills2.org/EWDW
Axis2 tutorials freely available at http://www.agileskills2.org/DWSAA
-- 
View this message in context:
http://www.nabble.com/%22required%22-for-Checkbox-tp14662131p14662131.html
Sent from the Wicket - User 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