/    Sign up×
Community /Pin to ProfileBookmark

Username & Password Form Validation Help, Pls

Hello, I use the following form for members to register to my website, Is there anyway i can limit and verify that only a maximum of 6 characters are entered in the Login & Password fields and that they contain only letters & numbers.

Thank you in advance

<font face=”verdana,arial” size=-1>
<center><table cellpadding=2 cellspacing=0 border=0>
<tr><td bgcolor=”blue”><table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td bgcolor=”blue” align=center style=”padding:2;padding-bottom:4″><b><font size=-1 color=”white”>Registration. Please fill in the form below.</font></th></tr>
<tr><td bgcolor=”white” style=”padding:5″><br>
<form method=”post” action=”http://www.address/cgi-bin/a.fcgi” name=pform><input type=”hidden” name=”action” value=”reg2″>
<input type=”hidden” name=”user” value=”user”>
<input type=”hidden” name=”regcode” value=””>
<center><table>
<tr><td><font face=”verdana,arial” size=-1>Email:</td>
<td><font face=”verdana,arial” size=-1><input type=”text” name=”_email”></td></tr>
<tr><td><font face=”verdana,arial” size=-1>Login:</td>
<td><font face=”verdana,arial” size=-1><input type=”text” name=”_
login”></td></tr>
<tr><td><font face=”verdana,arial” size=-1>Choose password:</td>
<td><font face=”verdana,arial” size=-1><input type=”password” name=”_password”></td></tr>
<tr><td><font face=”verdana,arial” size=-1>Verify password:</td>
<td><font face=”verdana,arial” size=-1><input type=”password” name=”_
password2″></td></tr>
<tr><td><font face=”verdana,arial” size=-1> </td>
<td><font face=”verdana,arial” size=-1><input type=”submit” value=”Submit”></td></tr>
</table></center>
</form>
</td></tr></table></td></tr></table>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@deep_dhyaniJan 09.2006 — <i>
</i>&lt;!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;script type="text/javascript" language="javascript"&gt;
function validate(){
with(document.f1)
{

<i> </i> if(_login.value.length&lt;=6){
<i> </i> alert("Id length should be 6 character !");
<i> </i> _login.focus();
<i> </i> return false;
<i> </i> }

<i> </i> }
<i> </i> return true;
<i> </i>}

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;font face="verdana,arial" size=-1&gt;
&lt;center&gt;&lt;table cellpadding=2 cellspacing=0 border=0&gt;
&lt;tr&gt;&lt;td bgcolor="blue"&gt;&lt;table cellpadding=0 cellspacing=0 border=0 width=100%&gt;&lt;tr&gt;&lt;td bgcolor="blue" align=center style="padding:2;padding-bottom:4"&gt;&lt;b&gt;&lt;font size=-1 color="white"&gt;Registration. Please fill in the form below.&lt;/font&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor="white" style="padding:5"&gt;&lt;br&gt;
&lt;form name="f1" onSubmit="return validate()" method="post" action="http://www.address/cgi-bin/a.fcgi" name=pform&gt;&lt;input type="hidden" name="action" value="reg2"&gt;
&lt;input type="hidden" name="user" value="user"&gt;
&lt;input type="hidden" name="regcode" value=""&gt;
&lt;center&gt;&lt;table&gt;
&lt;tr&gt;&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;Email:&lt;/td&gt;
&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;&lt;input type="text" name="_email"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;Login:&lt;/td&gt;
&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;&lt;input type="text" name="_login" maxlength="6"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;Choose password:&lt;/td&gt;
&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;&lt;input type="password" name="_password" maxlength="6"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;Verify password:&lt;/td&gt;
&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;&lt;input type="password" name="_password2" maxlength="6"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt; &lt;/td&gt;
&lt;td&gt;&lt;font face="verdana,arial" size=-1&gt;&lt;input type="submit" value="Submit"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/center&gt;
&lt;/form&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;


Copy linkTweet thisAlerts:
@al_nasserSep 09.2006 — I want to do these Validation in a web site and i don't know how to do it using javascript(the web page about job seeker):


1-ABN

Employers should be allowed to enter the ABN in any one of the following formats though it must be stored internally without any hyphens, spaces or commas.

dd-ddd-ddd-ddd

dd ddd ddd ddd

dd,ddd,ddd,ddd

ddddddddddd

2-Phone Number

The phone number should be in one of the following formats.

dddddddd

dd-dddddddd

dddd-dddddd (mobile)



3-Email Address

Assume that email addresses must end with either .au, .com, or .net and must not have two adjacent non-alphanumeric characters such as .. or --. It must contain the character @ exactly once and it must have at least two other characters after @.

4-Username/Password

Both username and password must consist of at least 6 alphanumeric characters, and password cannot have two or more adjacent characters the same (12yuu678 is not allowed because of uu).

If any of the fields are empty, an appropriate error message should be displayed indicating the problem. If the username already exists, an appropriate error message must be printed.
×

Success!

Help @iant spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...