www.webdeveloper.com
Results 1 to 2 of 2

Thread: form will not check email

  1. #1
    Join Date
    Nov 2013
    Posts
    2

    form will not check email

    Could someone please look at this for me. Please. I cannot figure out why the form will not go to the xml file and check the emails on it. It is supposed to check the xml for the email and if it is on the xml file then it returns "you cannot use this form"

    HTML

    Code:
    <!DOCTYPE html>
    <html lang="en">
    	<head>
    		<script type="text/javascript">
    			var asyncRequest;
    					
    			function getEmail(file)
    				{
    					document.getElementById("email").innerHTML = "";
    					asyncRequest = new XMLHttpRequest();
    					asyncRequest.onreadystatechange = "";
    				
    					asyncRequest.open("GET", file, true);
    					asyncRequest.send(null); 
    					
    					
    					
    						if (document.email== false)
    							{
    								window.alert("You cannot use this form!");
    							}
    						else
    							{
    								window.alert("Your form will be processed!");
    							}
    				}
    			
    		</script>
    	</head>
    	<body>
    	<header>
    		<h1>E-Mail Form</h1>
    	</header>
    	<label for="email">E-Mail Address</label>
    	<input type="text" name="email" value="" id="email" />
    	<label for="firstName">First Name</label>
    	<input type = "text" name="firstName" value = "" id ="firstName" />
    	<label for="lastName">Last Name</label>
    	<input type = "text" name = "lastName" value ="" id= "lastName"  />
    	<input type="button" name="submit" value="Submit" id="Submit" onclick="getEmail('email.xml')" />
    	
    	</div>
    	<footer>
    		&copy; BLE
    	</footer>
    </body>
    </html>

    XML

    Code:
    <?xml version="1.0"?>
    <address>
    	<address>
    		<email>frautani@ymail.com</email>
    	</address>
    		<address>
    		<email>stella@ymail.com</email>
    	</address>
    		<address>
    		<email>timster@aol.com</email>
    	</address>
    </address>

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,653
    Code:
    <script type="text/javascript">
    function getEmail(file){
    if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest();}
    else {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
    xmlHttp.open("GET",file,false);
    xmlHttp.send();
    var data=xmlHttp.responseText,str=document.getElementById("email").value;
    if(data.indexOf(str)!=-1){window.alert("You cannot use this form!");}
    else{window.alert("Your form will be processed!");}
    }
    </script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles