i used the above code but it didnt work i dont why
i also i want to validate the the radio buttons so i know if user answered both of the questions
- function checkForm() {
-
//This fuction shows that the user need to answer Question one
-
-
var el = document.forms[0].elements;
-
for(var i = 0 ; i < el.length ; ++i) {
-
if(el[i].name == "visites") {
-
var radiogroup = el[el[i].name];
-
var itemchecked = false;
-
for(var j = 0 ; j < radiogroup.length ; ++j) {
-
if(radiogroup[j].checked) {
-
itemchecked = true;
-
break;
-
}
-
}
-
if(!itemchecked) {
-
alert("Please Answer Question One");
-
if(el[i].focus)
-
el[i].focus();
-
return false;
-
}
-
}
-
}
-
return true;
-
}
i used this twice but i dont know how