Can't validate checkbox in contact form
mangiove opened this issue · comments
I'm trying to make a generic contact form with an input type checkbox for the privacy policy acceptance.
It seems that for the input type checkbox the "required" attribute for validation does not work, cause even if checked it will still remain invalid...
Thanks you
Regards
thanks for the feedback. it's using a fairly simple js-library for this check - could you find the solution and post it here?
Ok, I found a solution, it is cause of smoke plugin.
Looking the examples on site http://alfredobarron.github.io/smoke/#/validate I noticed that they are using a name attribute for the input type checkbox
<input type="checkbox" name="check" value="1" required>
Without using that the validation wont work...
I assume it is the same for radio too, name attribute is necessary
<input type="radio" name="rad" value="option1" required>
Thanks you
@lucatescari could you update the examples to use the name attribute, as this seems necessary in some cases?
@lucatescari and please add an example with a checkbox required
In the new release, I added a required checkbox (with a comment, that you have to use the name attribute) to the smart form template.