Demo validation of Period button

genderMale Female
Click the submit button to validate the form

Tutorial on Period button Validation

JavaScript

<script type="text/javascript"> 
function validate(form) { 
// Checking if at least one period button is selected. Or not. 
if (!document.form1.gender[0].checked && !document.form1.gender[1].checked){ 
document.getElementById('my_msg').innerHTML="Please select one 
radio button before submitting";
return false;}

document.getElementById('my_msg').innerHTML=" Validation is passed, 
	form is submitted ";
return false;   // Validation is passed but form is not submitted. 
//return true; // un comment this line to submit the form
}
</script>

HTML

<form name='form1' method=post action=action_page.php onsubmit='return validate(this)'>
<input type=hidden name=todo value=post>

<b>gender</b><input type=radio name=gender value='male'>Male 
<input type=radio name=gender value='female'>Female</div>
<div class='col-md-6'>
<div id='my_msg'>Click the submit button to validate the form</div></div>
</div>

<div class='row'>
<div class='col-md-6'>
<input type=submit value=Submit> <input type=reset value=Reset></form></div>

Tutorial on Period button Validation

Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer