Jump to content

CHecking Fields Before Submitting


ballouta

Recommended Posts

Hello

I have this form:

 

<FORM name=frm method="POST" action="register.php">
<p dir="ltr" style="margin-bottom: 15px">
<font face="Verdana" color="#FF0000" style="font-size: 9pt; font-style: italic">
required fields</font></p>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0">
	<tr>
		<td width="87"><font face="Verdana" size="2">Full Name</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="fname" size="20" style="color: #000000"></td>
	</tr>
	<tr>
		<td width="87"><font face="Verdana" size="2">Email</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="email" size="20" style="color: #000000"></td>
	</tr>
	<tr>
		<td width="87"><font face="Verdana" size="2">Mobile #</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="mobile" size="20" style="color: #000000"></td>
	</tr>
<tr>
		<td width="87"><font face="Verdana" size="2">Country</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="text" name="country" size="20" style="color: #000000"></td>
	</tr>
	<tr>
		<td width="87"><font face="Verdana" size="2">password</font></td>
		<td width="23">
		<p align="center"><font face="Verdana" size="2">:</font></td>
		<td>
		<input type="password" name="pass" size="20" style="color: #000000"></td>
	</tr>

 

and this javascript in a separate file, it working properly.

 

function isReady() {

// check if the First Name is valid
    if (isProper(frm.fname.value) == false) {
        alert("Please enter your First Name");
        return false;
    }

// check if the email address is valid
    if (isEmail(frm.email.value) == false) {
        alert("Please enter a valid email address");
        return false;
    }
    return true;
}

 

I need to add to code:

1) mobile verification, only numbers are allowed, no matter how long

2) make sure that the password is between 8 and 12 characters.

 

Thanks alot

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.