It is necessary to check the input of the radio button, i.e. when the submit button is pressed and no radio buttons have been selected, it warns the user saying “select the checkbox”, and if the radio button is selected, just submit the form, does not need a warning.
You can use HTML CSS and JavaScript for this, I know that it is 1000 times easier in jquery, but unfortunately I can not use it.
And I know that my HTML is not valid, but if it does not directly affect my current problem, I will process it later.
<form name="form1" action="#" onsubmit="return validateForm()" method="post"> First time visitor?:<br/> <label for="s1">Yes</label> <input type="radio" id="1" name="yesno" value="1"/> <br/> <label for="s2">No</label> <input type="radio" id="1" name="yesno" value="2"/> <br/> <input type="submit" value="Submit"><br/> </form>
Any pointers are very appreciated, thanks.
user1359421
source share