Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Pre-Validate Form Field Contents Before formmail Processes Submit

  1. #11
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Pre-Validate Form Field Contents Before formmail Processes Submit

    Hi,

    Check for the inclusion of "formval" <script>.

    Perhaps your validation doesn't work with ours.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  2. #12
    Join Date
    Sep 2010
    Posts
    11

    Default Re: Pre-Validate Form Field Contents Before formmail Processes Submit

    Hello Russell.

    No sign of a "formval" <script> in my form HTML.

    My _validate.js script is pretty simple. Here it is below:


    Code:
    function mastervalidate(frm)
    	{
    	if(frm.fullname.value=="")
    		{
    		alert("Please enter your name");
    		frm.fullname.focus();
    		return false;
    	}
    		
    	if(frm.address.value=="")
    		{
    		alert("Please enter your address");
    		frm.address.focus();
    		return false;
    	}
    	if(frm.city.value=="")
    		{
    		alert("Please enter your city");
    		frm.city.focus();
    		return false;
    	}
    		
    	if(frm.state.value=="")
    		{
    		alert("Please enter your state");
    		frm.state.focus();
    		return false;
    	}
    		
    	if(frm.zipcode.value=="")
    		{
    		alert("Please enter your zipcode");
    		frm.zipcode.focus();
    		return false;
    	}
    
    
    	if(frm.country.value=="")
    		{
    		alert("Please enter your country");
    		frm.country.focus();
    		return false;
    	}
    	
    	if(frm.cardnum.value=="")
    		{
    		alert("Please enter your card number");
    		frm.cardnum.focus();
    		return false;
    	}
    	
    	if((frm.cardnum.value.length != 16 && frm.cardnum.value.length != 13) && frm.cardtype.value=="visa")
    		{
    		alert("Please enter a 13 or a 16-digit Visa card # without spaces or dashes. E.g., 4123412341234123 or 4123412341234");
    		frm.cardnum.focus();
    		return false;
    	}
    	
    	if((frm.cardtype.value=="mc" || frm.cardtype.value=="dis") && frm.cardnum.value.length != 16)
    		{
    		alert("Please enter a 16 digit Mastercard or Discover card # without spaces or dashes. E.g., 5123412341234123");
    		frm.cardnum.focus();
    		return false;
    	}
    	
    	if(frm.cardtype.value=="amex" && frm.cardnum.value.length != 15 )
    		{
    		alert("Please enter a 15-digit Amex card # without spaces or dashes. E.g., 312341234123412");
    		frm.cardnum.focus();
    		return false;
    	}
    		
    	if(frm.CVC.value=="")
    		{
    		alert("Please enter your CVC code");
    		frm.CVC.focus();
    		return false;
    	}
    	
    	if((frm.cardtype.value=="visa" || frm.cardtype.value=="mc" || frm.cardtype.value=="dis") && frm.CVC.value.length != 3)
    		{
    		alert("Please enter the 3 digit security code on the back of your Visa, Mastercard or Discover card. E.g., 234");
    		frm.CVC.focus();
    		return false;
    	}
    	
    	if(frm.cardtype.value=="amex" && frm.CVC.value.length != 4 )
    		{
    		alert("Please enter the 4 digit security code on the front of your Amex card. E.g., 1234");
    		frm.CVC.focus();
    		return false;
    	}
    	
    	if(frm.emailaddress.value=="")
    		{
    		alert("Please enter your Email Address");
    		frm.emailaddress.focus();
    		return false;
    	}
    	
    	
    	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(frm.emailaddress.value))) 
    	    {
    			alert("Please enter a VALID email address");
    			frm.emailaddress.focus();
    			return false;
    	}
    	
    	return true
    		
    }//end function


  3. #13
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Pre-Validate Form Field Contents Before formmail Processes Submit

    Hi,

    It looks OK.

    But this isn't really a FormMail issue.

    Diagnosing JavaScript problems isn't trivial, so I recommend you try to get some help on a forum such as stackoverflow.com.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  4. #14
    Join Date
    Sep 2010
    Posts
    11

    Default Re: Pre-Validate Form Field Contents Before formmail Processes Submit

    I did discover that Formmail is not keeping the onSubmit from triggering. So that helped to isolate the issue. The Google Chrome Developer tool is so handy.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sample HTML Form Using FormMail
    By russellr in forum FormMail
    Replies: 1
    Last Post: 21-Mar-2007, 06:49 AM
  2. Error when submit is clicked
    By thall1908 in forum FormMail Subscription Support
    Replies: 6
    Last Post: 11-Nov-2004, 11:28 PM
  3. CPU Maxed after (maybe?) double click of submit?
    By OKUser in forum FormMail Subscription Support
    Replies: 6
    Last Post: 23-Jun-2004, 07:33 PM
  4. Problem with Form Field
    By joe3366 in forum FormMail Subscription Support
    Replies: 5
    Last Post: 13-Jun-2004, 09:02 PM
  5. Redirect to my page on submit
    By insight in forum FormMail Subscription Support
    Replies: 21
    Last Post: 09-Apr-2004, 12:06 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
  •