I’m trying to make a scenario where you must choose one answer for radio or multiple answers checkboxes before submitting. When I try I end up making it so the user HAS to choose a specific answer which isn’t what I want.
Could you post the code?
<form action="/submit-cat-photo">
<label><input type=“radio” name="indoor-outdoor"required> Indoor</label>
<label><input type=“radio” name=“indoor-outdoor”> Outdoor</label><br>
<label><input type=“checkbox” name=“personality” > Loving</label>
<label><input type=“checkbox” name=“personality” required > Lazy</label>
<label><input type=“checkbox” name=“personality”> Energetic</label><br>
<input type=“text” placeholder=“cat photo URL” required>
<button type=“submit”>Submit</button>
</form>
Check this. I just used required on each of the radio button. You could now add a Submit button event in jQuery or JS to perform validation in case there are unselected radio s
If you are trying to make it so at least one checkbox in a group of checkboxes are required, then I don’t believe you can do that without using JavaScript.
He is a (randomly selected) solution with Jquery
hey thanks for your help man