Hello
How do you validate radio buttons?
I do not see a validator in validators.js file
How you can validate it? Could you post a fiddle with example?
Hello
I have created a fiddle here: https://jsfiddle.net/sjordan/p66mv49o/8/
Hope you don't mind, I expanded the question to:
How do I validate radio buttons? (In my example, one value must be selected before the form is allowed to be submitted)
How do I validate checkbox? (In my example, I want the checkbox to be checked before the form is allowed to be submitted)
Hi, thanks the fiddle. I updated: https://jsfiddle.net/p66mv49o/10/
So I used required validator for radios: validator: VueFormGenerator.validators.required
And created a custom validator for agree checkbox:
validator: function(value) {
if (value !== true)
return ["Please agree!"];
}
And you need to define onSubmit handler in the schema.
@icebob Thank you. I'll try to incorporate this into my code.
@icebob Thank you
Most helpful comment
Hi, thanks the fiddle. I updated: https://jsfiddle.net/p66mv49o/10/
So I used required validator for
radios:validator: VueFormGenerator.validators.requiredAnd created a custom validator for agree checkbox:
And you need to define
onSubmithandler in the schema.