Hi,
I am fairly new to dojo and am looking to use it for input field validation. I have used the help to assist me with getting the text box validation to work very successfully however, I have a number of checkboxes and radio buttons on my form, which I also want to make mandatory. I can obviously write my own javascript to handle this but I presumed dojo would offer me something similar to the "dijit.form.ValidationTextBox" but for checkboxes etc.. My other issue with writing my own is the look and feel will be very different. I have searched both this site and through google but could only find the odd references to dojox.validate.check but with no obvious way of implementing it. Do I need to make use of the dojo.event and call an onchange function on the combobox, which checks if an option has been selected, but then I have the issue of how I can highlight this to the user so it looks like the validation text box?
Can anyone help me, I am sure I am not the only person wanting to do this?
Thanks in advance.

i would say that logically,
i would say that logically, a checkbox can't be validated or required. you've already limited the user to all the valid options - checked or not checked - and either option should satisfy any logic that "requires" the user's response.
as for radio buttons, you've provided the user with all valid options so i would say that there is no need for "validation." the only thing that could be needed with radios is to ensure that the user has in fact selected something if a response is "required". i'm not sure if dojo already handles this because i don't think it provides a "required" field for radios as it does for some other widgets - at least not according to the api.
Accepting a form's terms of service
Validation for radio buttons and check boxes could be useful when the user must accept terms of use to submit the form. For example:
not the same as valid or required
in my opinion, that is not the same as valid or required. keep in mind that in this context, valid and required are terms relating to form validation. valid means that the value of the field is within the set of acceptable values (ie the value entered is the kind of value that can be made sense of by your application) and required means that the field has some (or any) value.
for a radio button "No" is also a valid response. it is a response that your application can understand. if it wasn't a valid response then you shouldn't have put it as one of the options and besides that you would probably keep presenting the form to the user until they entered a valid response. you probably wouldn't continue to present the form to the user again just because they entered "No". the fact that you will not let them continue on to another part of your website if they choose "No" does not make it an invalid response when submitting the form. however, it does make sense to require the user to select either the "Yes" or "No" radio button and so making a radio button required makes sense - if the user has not selected "Yes" or "No" then you might keep presenting the form to them until they select one of those options because until they select either one of them the field attached to the buttons may have no value.
for a check box there is no sensible way to require it because it always has a value of one of the 2 valid options (checked or unchecked, true or false) and so there is never a time when it doesn't have a value so requiring it would be redundant - it always has a value. also, it is automatically valid because you have already limited all response to valid options - checked or not checked (true or false - whatever you prefer). both of these options are valid even if it means that you are going to restrict the user's actions if they leave the box unchecked.
in general, it would not make sense to check for a valid response for any input element that has limited options - all of those options should be valid already. it also does not make sense to require any input element that cannot have a "non-value" since it will always have a value.
Validating Controls' States
Thank you for your reply. I respect your opinion and realize that the radio button and check box controls present a very restricted number of states, making the controls much safer than more free-form inputs. So, do you feel that restricting the user's available options based on these two controls' states is outside the scope of field-level validation?
While
(checked == false)for the check box may be a valid state for the control, it is an invalid state for the form and its business rules. Perhaps including this kind of validation (a lightweight business rule) is beyond the scope of field-level validation. A Dijit validation constraint would be a convenient way to verify the client (it's obviously always verified server-side), but it might not be the most correct way to do this. What are your thoughts?I ask, because the
NumberTextBoxallows the user to type any number. When that number exceeds the defined range constraint (which is probably dictated by a business rule), the control marks the input as invalid. It seems like a similar case, but I may be way off.As a side note, I readily agree a "No" radio button is not the best control for agreeing to terms and conditions. In this case, it isn't something I have control over, as this requirement was mandated by a business user. Providing a "Yes" check box does seem like a better choice in my opinion. As a legal requirement, some sites are required to capture an explicit user response (checking the box) to indicate his or her consent to the form's terms. The business and the form itself do not have the legal authority to let the user continue without this explicit consent.