How to validate radio button for gender using javascript
FOr male and female radio button how to validate using javascript?.........
Status:
Open Jun 18, 2010 - 01:36 AM
JavaScript, Button
2answers
Answers
Aug 09, 2010 - 02:34 AM
Hi Mythili,The first step is to create the radio buttons 1st
2nd
The next step is to validate using the java script.function valbutton(thisform) {// place any other field validations that you require here// validate myradiobuttonsmyOption = -1;for (i=thisform.myradiobutton.length-1; i > -1; i--) {if (thisform.myradiobutton[i].checked) {myOption = i; i = -1;}}if (myOption == -1) {alert("You must select a radio button");return false;}alert("Gender : " + thisform.myradiobutton[myOption].value);// place any other field validations that you require herethisform.submit(); // this line submits the form after validation}Hope this helps
Mar 31, 2012 - 10:56 AM
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points.
The Quomon Team
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment