i want to dont let the user submit the form unless they answer these two radio buttons questions but i dont why isnot working the code
Code:
unction checkForm(obj) //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 == "att") {
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 false;
}
//-->
<!--
function Checkanswers(obj) {
var Invalid;
Invalid= checkForm(obj.att);
if (Invalid)
return (!Invalid);
}
//-->
</script>
</head>
<body>
<form id="forms" method="post" action="http://tl28serv.uws.edu.au/twainfo/form.asp" onsubmit="return Checkanswers(this);" >
<h1> Advanced Standing Application </h1>
<h3>1- Personal Details </h3>
<h4> The questions with * are mandatory so please answer them-Thank you</h4>
<p> Are you currently enrolled at UWS?*<br/>
<input type="radio" name="att" value="n"/> No <br/>
<input type="radio" name="att" value="y"/> Yes then Student ID
<input type="text" name="ID" size="30" maxlength="8" onblur="checkNum(this)" /> </p>
<p> Are you an international student?* <br/>
<input type="radio" name="int" value="N"/> No <br/>
<input type="radio" name="int" value="Y"/> Yes </p>
Comment