Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation

Status
Not open for further replies.

petenyce105

Programmer
Joined
Feb 3, 2004
Messages
12
Location
US
I have a pop up window that searches a database. now i want the user to type in a min of three characters. i used this script but it passes the validation and dosent even validate
can someone help me?

<form method=&quot;post&quot; name=&quot;registerForm&quot; onsubmit=&quot;Nice()&quot;>
<script language=&quot;javascript&quot;>
function Nice(){
if (registerForm.Surname.length < 3)
{
alert(&quot;Enter more than three characters.&quot;);
document.registerForm.Surname.focus();
return;
}
}
</script>
 
Hi there,

<... onSubmit=return&quot;Nice(this);&quot;>

That should do it!

[cheers]
Cheers!
Laura
 
Hi Sorry, I had a typo in my previous post:

<... onSubmit=&quot;return Nice(this);&quot;>

(Had the quotation marks in the onSubmit in the wrong place.)



[cheers]
Cheers!
Laura
 
and don't forget to append a &quot;return false;&quot; at the end of your function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top