Page 1 of 1

How to code minimum entry

Posted: Mon Oct 19, 2009 12:26 pm
by adsegzy
My fellow success-oriented people,

i need to code my password field to contain the minimum character of 6 characters and reject any entry lesser than 6 characters. How do i do it?

Regards
adsegzy

Re: How to code minimum entry

Posted: Mon Oct 19, 2009 12:38 pm
by nshiell
Flattery'll get u nowhere lol
In php it would be something like

Code: Select all

 
if (strlen($_GET['password']) < 6)
{
// Do something to let user know that the form has been refused
}
 
If you have time you could also do a JavaSCript as well AFTER YOU HAVE GET THE SERVER SIDE WORKING!

Code: Select all

 
<script type="text/javascript>
function validateForm()
{
if (getElementById('password').value.length < 6)
{
alert('BAD');
return false;
}
}
</script>
<form action="#" method="get" onsubmit="validateForm()">
<input type="password" name="password" id="password">
</form>
 

Re: How to code minimum entry

Posted: Mon Oct 19, 2009 1:04 pm
by JNettles
Probably shouldn't double-post your questions either.........