...

View Full Version : Form Validation Javascript Help



brycem
01-09-2007, 05:46 AM
G'day ppl,

I have just found a form validation script and all is working fine
the only thng is that in my form i have a drop menu and i cant figure out how to get this to work.

the script so far is.


<script language="JavaScript"> function formCheck()
{
if (document.JFCSMS.SURNAME.value == "")
{
alert("Please enter SURNAME.");
document.JFCSMS.SURNAME.focus();
return false;
}
if (document.JFCSMS.NAME.value == "")
{
alert("Please enter NAME.");
document.JFCSMS.NAME.focus();
return false;
}

if( isNaN(document.JFCSMS.MOBILE NUMBER.value) )
{
alert('Please enter a vaild Mobile Number!');
document.JFCSMS.MOBILE NUMBER.focus();
return false;
}
if (document.JFCSMS.MOBILE NUMBER.value == "")
{
alert("Please enter Mobile Number.");
document.JFCSMS.MOBILE NUMBER.focus();
return false;
}

}


</script>
</head>
<body>
<form name="JFCSMS" method="post" action="cgi-bin/FormMail.pl" onsubmit="return formCheck()">
<input type=hidden name="recipient" value="email@myserver.com.au">
<p><span style="font-size:9pt;"><font face="Arial"><input type="text" name="SURNAME"><br>
</font><font face="Arial" color="black">Given Name:<input type="text" name="NAME"><br>
Mobile Number:</font><font face="Arial"><input type="text" name="MOBILE NUMBER"><br>
</font><font face="Arial" color="black">Relation to JFC:</font></span><br>
<select name="RELATION TO JFC" size="1">
<option selected value>- - - - - - - - -</option>
<option>Coach</option>
<option>Committee</option>
<option>Parent</option>
<option>Past Player</option>
<option>Player</option>
<option>Sponsor</option>
<option>Volunteer</option>
<option>Other</option>
</select><br><input type=hidden name="title" value="JFC SMS Registration">
<br><input type=hidden name="redirect" value="http://www.myserver.com.au/thanks.html">
<input type="submit" name="SUBMIT" value="Submit"> <input type="reset" name="RESET" value="Clear"></form>
</body>

If anyone can help me that would be great Thanks

Bryce

brycem
01-09-2007, 07:00 AM
DW i fixed the problem



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum