Results 1 to 2 of 2

Thread: Lead Capture Issues

  1. #1
    revolve is offline Sugar Community Member
    Join Date
    Jan 2007
    Posts
    26

    Exclamation Lead Capture Issues

    Hi,

    I have my lead capture form created based on the form created in Sugar.

    The JavaScript validation works, but the issue is when the JavaScript prompt box pops up if you click "Ok" it still processes the form and sends you to the Redirect page.

    I've tried two different validation scripts and they both had the same issue?

    Can someone help?

    Thanks,
    Seth

  2. #2
    westbym is offline Junior Member
    Join Date
    Mar 2007
    Posts
    2

    Default Re: Lead Capture Issues

    This is some handy code that I found and currently use. Only prompts user if there is a problem
    Code:
      	<script type='text/javascript'>
    
    	function formValidator(){
    		// Make quick references to our fields using their input names
    		var Name = document.getElementById('Name');
    		var Homephone = document.getElementById('Homephone');
    		var Email1 = document.getElementById('Email1');
    
    		// Check each input in the order that it appears in the form!
    		if(isEmpty(Name, "Please enter only letters for your name")){
    			if(isNumeric(Homephone, "Please enter a valid phone number")){
    				if(emailValidator(Email1, "Please enter a valid email address")){
    					return true;
    				}
    			}
    		}
    
    
    
    		return false;
    
    	}
    
    	function isEmpty(elem, helperMsg){
    		if(elem.value.length == 0){
    			alert(helperMsg);
    			elem.focus(); // set the focus to this input
    			return false;
    		}
    		return true;
    	}
    
    	function isNumeric(elem, helperMsg){
    		var numericExpression = /^[0-9]+$/;
    		if(elem.value.match(numericExpression)){
    			return true;
    		}else{
    			alert(helperMsg);
    			elem.focus();
    			return false;
    		}
    	}
    
    	function isAlphabet(elem, helperMsg){
    		var alphaExp = /^[a-zA-Z]+$/;
    		if(elem.value.match(alphaExp)){
    			return true;
    		}else{
    			alert(helperMsg);
    			elem.focus();
    			return false;
    		}
    	}
    
    	function isAlphanumeric(elem, helperMsg){
    		var alphaExp = /^[0-9a-zA-Z]+$/;
    		if(elem.value.match(alphaExp)){
    			return true;
    		}else{
    			alert(helperMsg);
    			elem.focus();
    			return false;
    		}
    	}
    
    	function lengthRestriction(elem, min, max){
    		var uInput = elem.value;
    		if(uInput.length >= min && uInput.length <= max){
    			return true;
    		}else{
    			alert("Please enter between " +min+ " and " +max+ " characters");
    			elem.focus();
    			return false;
    		}
    	}
    
    	function madeSelection(elem, helperMsg){
    		if(elem.value == "Please Choose"){
    			alert(helperMsg);
    			elem.focus();
    			return false;
    		}else{
    			return true;
    		}
    	}
    
    	function emailValidator(elem, helperMsg){
    		var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
    		if(elem.value.match(emailExp)){
    			return true;
    		}else{
    			alert(helperMsg);
    			elem.focus();
    			return false;
    		}
    	}
    </script>

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need help with Lead capture
    By trey5498 in forum Help
    Replies: 2
    Last Post: 2007-01-26, 04:47 PM
  2. Need help with Lead capture
    By trey5498 in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-01-24, 04:25 PM
  3. Online Lead Capture and Self Service Portal
    By cehrenthal in forum General Discussion
    Replies: 7
    Last Post: 2006-10-23, 02:21 AM
  4. From lead to order
    By george_bbch in forum Feature Requests
    Replies: 0
    Last Post: 2006-09-26, 02:02 PM
  5. Lead to Capture - Multiple Users
    By breathe_easily in forum Help
    Replies: 2
    Last Post: 2006-05-25, 11:23 AM

Bookmarks

Posting Permissions

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