0

hello...
i am doing registration form .in this without submit form can i get alert box....email already exists using javascript. can any body tell me.


thnks.

3
Contributors
3
Replies
8
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

If you google "javascript alert" you will find many examples of how to create a javascript alert box.

Your algorithm should follow these steps:
1. Get the entered email address from the form.
2. Validate the email address has a valid format.
3. Use SQL statement to see if the email address exists in your database.
4. Display an error message in an alert if the email does exist.

0

If you google "javascript alert" you will find many examples of how to create a javascript alert box.

Your algorithm should follow these steps:
1. Get the entered email address from the form.
2. Validate the email address has a valid format.
3. Use SQL statement to see if the email address exists in your database.
4. Display an error message in an alert if the email does exist.

i am using like this ...but it is not working.

email=window.document.create_profile.email.value;
var emailFormat = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-zA-Z]{2,6}(\.[a-zA-Z]{2})?$/i;
if(email== "")
{	
	alert("Please enter Email Id.");
	window.document.create_profile.email.focus();
	return false;
		
}

if(email!= "")
{	
	var eres=email.search(emailFormat);
	if(eres == -1)
	{
		alert("Please Enter Valid Email Id ");
		window.document.create_profile.email.select();
		return false;
	}
	else
	{
	
	<?
	$selectemail=mysql_query("select * from workseeker_registration");
	while($fetchemail=mysql_fetch_array($selectemail))
	{
	
	?>
	
var existemail=<?=$fetchemail['email']?>;

	if(email==existemail)
	{
	alert("This email already exists");
		window.document.create_profile.email.select();
		return false;
		}
	<?
	}
	?>
	}
}
else
{
return true;
}
0

Check with google whether gotFocus and lostFocus available for textboxes, if it is, then you can call your javascript code on lostfocus to avoid the submit button validate.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.