| View previous topic :: View next topic |
| Author |
Message |
chimp
Joined: 05 Dec 2006 Posts: 1
|
Posted: Tue Dec 05, 2006 8:48 am Post subject: Form Validation Help Needed Please |
|
|
I am new here so hi to everyone, I have been told by a friend that this site is particularly helpful so here goes.
I have a form that i want to ensure is filled out correctly before the user is able to proceed. I am also advised that Javascript is the easiest way to do this, however i have no idea how to implememnt it.
http://chimp.cc/start.htm
If the user fails to fill out the terms and conditions box with a "Yes"when the user clicks submit, i want a message to pop up to tell them to complete it.
and to return the user to that field for completion.
I honestly have no idea how to do this, can someone please help me.
Cheers
Andy |
|
| Back to top |
|
 |
|
|
ngpgeeta
Joined: 18 Nov 2006 Posts: 19
|
Posted: Sun Dec 17, 2006 10:19 am Post subject: Re: Form Validation Help Needed Please |
|
|
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<script>
function checking()
{
var v=document.f1.accept.value
if(v=="yes")
return true
else
{
alert("Form will be submitted only if the terms and conditions are accepted.")
return false
}
}
</script>
<BODY>
<form name="f1" action="something" onsubmit="return checking()">
Please type in Yes to say you have read and agree to the terms and conditions <input type=text" name="accept" value=""><br>
<input type="submit" value="submit">
</form>
</BODY>
</HTML>
Hope this helps! |
|
| Back to top |
|
 |
|