I have a problem,javascript validation form put this in and check it out yourself then you will see my problem:
Entry Form
function validateForm()
{
var result = true;
var msg="";
var examnumberlimit = 4
if (document.ExamEntry.name.value=="") {
msg+="You must enter your name \n";
document.ExamEntry.name.focus();
document.getElementById('name').style.color="red";
result = false;
}
if (document.ExamEntry.subject.value=="") {
msg+="You must enter the subject \n";
document.ExamEntry.subject.focus();
document.getElementById('subject').style.color="red";
result = false;
}
if (document.ExamEntry.subject.value=="") {
msg+="You must enter the exam number \n";
document.ExamEntry.subject.focus();
document.getElementById('examnumber1').style.color="red";
result = false;
}
if(document.ExamEntry.examnumber.value.length==examnumberlimit) {
}
else
{
msg+=" Your exam number must be four digits long ";
document.ExamEntry.examnumber.focus();
document.getElementById('examnumber').style.colour="red";
result = false;
}
if ( ( document.ExamEntry.option[0].checked == false )
&& ( document.ExamEntry.option[1].checked == false ) )
{
alert ( "Please choose your entry level" );
valid = false;
}
if(msg==""){
return result;
}
{
alert(msg)
return result;
}
for (var i=0; i < document.ExamEntry.ExamLevel.length; i++)
{
if (document.ExamEntry.ExamLevel[i].checked)
{
level = document.ExamEntry.ExamLevel[i].value;
}
}
ConfirmMSg = confirm(level)
if (ConfirmMSg== true)
{
}
else
{
result = false;
return result;
exit()
}
}
Exam Entry Form
| Name |
|
| Subject |
|
| Exam Number |
|
| Examination Level |
GCSE
AS
A2 |
| |
Add New Comment