I have a form in AMP that has a set of checkboxes, for example:
<form method="post" target="_blank" name="form" custom-validation-reporting="show-all-on-submit" action-xhr="/some-xhr-action">
<span visible-when-invalid="valueMissing" validation-for="favoriteSports">You must select at least ONE sport.</span>
<label for="favoriteSports">Choose one or more of your favorite sports:</label>
<input type="checkbox" required id="favoriteSports" name="favoriteSports" value="football">Football</input>
<input type="checkbox" required id="favoriteSports" name="favoriteSports" value="baseball">Baseball</input>
<input type="checkbox" required id="favoriteSports" name="favoriteSports" value="basketball">Basketball</input>
<input type="checkbox" required id="favoriteSports" name="favoriteSports" value="soccer">Soccer</input>
<input type="submit" value="Submit"></input>
How can I validate that at least one of the favoriteSports checkboxes is checked using AMP?
Aucun commentaire:
Enregistrer un commentaire