I second Daniel's comments. +1 for option 1
From: Daniel Neugebauer <[email protected]> To: [email protected] Date: 04/01/2011 02:56 PM Subject: Re: [VOTE] Behavior of CheckBox With Respect to setRequired(true) I would stick with 1 (required to be checked). The main reason would be not to break compatibility with old versions. I actually used .setRequired(true) on legal checkboxes (disclaimers) in one of our applications because if I have a "required checkbox" I expect it to be needed to be checked. Although I will change that in our project now that I know such a change is being discussed, I wouldn't expect others to be that observant of the issue and have unit tests that prevent anything from breaking on a future upgrade. BTW an empty string (that's not null) is a string nevertheless. Following the argument that an unchecked (false) checkbox should be regarded as valid if it is required, an empty string should be accepted as a valid input as well. I've just tested it with Wicket 1.4 and actually both of the following TextFields validate to a failed state: TextField tf1 = new TextField("text1", new PropertyModel<String>(this, "test1")); tf1.setRequired(true); tf1.setConvertEmptyInputStringToNull(false); form.add(tf1); TextField tf2 = new TextField("text2", new PropertyModel<String>(this, "test2")); tf2.setRequired(true); tf2.setConvertEmptyInputStringToNull(true); form.add(tf2); So, TextField.setRequired doesn't validate the syntactic meaning as well, instead it validates the semantic meaning, just as CheckBox.setRequired does. If that's consistently used throughout Wicket, I would expect CheckBox.setRequired to validate false unless the CheckBox is actually checked. Just my 2 cents, Daniel --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information.
