Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 249 Time: 10:54 - Mar 17, 2011  

maxio

Somthing wrong with my javascript form please help!

Just paste this and try to fix it please:

<html>
<head>
<title>Exam entry</title>

<script language="javascript" type="text/javascript">

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.examnumber.value=="") {
msg+="You must enter the exam number \n";
document.ExamEntry.examnumber.focus();
document.getElementById('examnumber').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()
     }
  
  }
</script>

</head>

<body>
<h1>Exam Entry Form</h1>

<form name="ExamEntry" method="post" action="success.html">
<table width="50%" border="0">
<tr>
<td id="name">Name</td>
<td><input type="text" name="name" /></td>
</tr>


<tr>
<td id="subject">Subject</td>
<td><input type="text" name="subject" /></td>
</tr>

<tr>
<td id="examnumber">Exam Number</td>
<td><input name="examnumber" type="text" size="4" /></td>
</tr>


<tr>
    <td>Exaination Level</td>
<td><input type="radio" name="option" value="GCSE"> GCSE <br>
<input type="radio" name="option" value="AS" > AS <br>
<input type="radio" name="option" value="A2"> A2 </td>


</tr>



    <tr>
<td><input type="submit" name="Submit" value="Submit" onClick="return validateForm();" /></td> <td><input type="reset" name="Reset" value="Reset" /></td>
</tr>

</table>
</form>

</body>

</html>

Answer Discussion
Tutorials

 

This question has not yet been answered.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10354

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es