PDA

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



dante
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? :-/

tryanDLS
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.

dante
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?

tryanDLS
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.

longahc
25 Dec 2007, 8:27 PM
Tim,

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.

Thanks!

jit
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.

Thanks

Jit