Livevalidation script is great to validate forms but how you 're suppose to do with group of checkbox, radio, and select. see website : http://www.livevalidation.com/
相关问题
- Is there a limit to how many levels you can nest i
- Laravel Option Select - Default Issue
- How to toggle on Order in ReactJS
- Carriage Return (ASCII chr 13) is missing from tex
- void before promise syntax
I was having this same issue and came up with another way to look at it. I was using my radio group for acesses level -
So I just added a third level and set it to selected so that field is in essence required with a dummy value if you don't address the field.
For a select, you can use it just fine.
But for radio buttons, it doesn't seem to work.
LiveValidation only works for elements that have an "id", which is not possible with radio buttons. Seems like a limitation of LiveValidation. Anyone has a workaround ?
It can be done, though LiveValidation will fight you. You can't attach a validator to an input type="radio".
So what I have done is add a dummy input element something like:
to my form, then add a Validate.Custom to that. The custom validation function would be something like
This is what I did using the standalone LiveValidation and jQuery; probably can do something similar with prototype.js if you're using that version. One gotcha is that you must assign a value attribute to your dummy input element, because LiveValidation seems to skip inputs that have no value (excepting of course Validate.Presence).