View Full Version : Checkbox: what does isValid() check?

23 Nov 2007, 6:23 AM
As per the documentation, Checkboxes can be validated by ext. However, what is checked during a validation of a checkbox? There is neither a allowBlank nor a vtype attribute. So how can I define under which condition a Checkbox is valid? :-/

23 Nov 2007, 8:04 AM
Looking at the source, there's no base implementation of validation for a checkbox. The markInvalid/clearInvalid functions do nothing and are basically disabled.

27 Nov 2007, 1:44 AM
Okay, but then it would make sense to enable vtype functionality for checkboxes in order to provide a possibility for custom validation.

Should I post that in the bug forum?

27 Nov 2007, 10:40 AM
vtype is not really intended to do cross field validation. I would think you would want to be looking at using the form binding functionality to validate whether the checkbox is ok based on other inputs, or use the validation and/or event handling of the other fields to indicate the checkbox status.

25 Dec 2007, 8:27 PM

Don't you feel that adding an allowBlank attribute would be a valid for the Checkbox control? I have a checkbox on my registration page that must be checked for the form to be valid (i.e. "I am at least 13 years of age."). If that checkbox isn't checked I don't want the form to pass validation. I understand I can workaround this using the validation event but this is a common use case for the use of a checkbox. Thought I'd chime in on the suggested update.


14 Mar 2008, 2:40 AM
I'd also like to see checkboxes with the capability to support validation for the case where you want the user to always check the box, e.g. 'I agree to these terms and conditions'. It would be great if the markInvalid method could be added to them in a similar fashion to the other fields.