I am using this function to validate my form.....I am able to validate all the fields except radio buttons, I am not able to figure it out whats the problem with the function.
how do i make it so that it validates the radio buttons too
here is the code.....
<br>
<br>
<br>var strAlertMsg = ""
<br>var focusField = ""
<br>//Validate Radio Button
<br>function checkRadioControl(theForm,strFieldName,strMsg){
<br> var objFormField = theForm.elements[strFieldName]
<br> intControlLength = objFormField.length
<br> bolSelected = false;
<br> for (i=0;i<intControlLength;i++){
<br> if(objFormField[i].checked){
<br> bolSelected = true;
<br> break;
<br> }
<br> }
<br> if(! bolSelected){
<br> strAlertMsg += "- "+ strMsg +" is Required.\n";
<br> return false;
<br> }
<br> return true;
<br>}
<br>
<br>
<br>//Begin Page Validation
<br>function validateForm(theForm){
<br>strAlertMsg = ""
<br>focusField = ""
<br> checkRadioControl(theForm,'radio1','What Kind of Issue do you have')
<br>
<br> if(strAlertMsg !=""){
<br> alert("Please correct the following errors:\n____________________________\n\n" + strAlertMsg);
<br> eval("theForm." + focusField + ".focus()");
<br> return false;
<br> }
<br> return true;
<br>}
<br>
<br>
<br>
What Kind of Issue do you have?: *
Problem/Question
Comment
Thanks