It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Form Validation Help Needed Please

Form Validation Help Needed Please

Postby chimp on Tue Dec 05, 2006 7:48 am

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
chimp
 
Posts: 0
Joined: Tue Dec 05, 2006 7:44 am

Postby ngpgeeta on Sun Dec 17, 2006 9:19 am

<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!
ngpgeeta
 
Posts: 19
Joined: Sat Nov 18, 2006 11:30 am


Who is online

Users browsing this forum: No registered users and 4 guests