FMP code for validating your emailid is same as confirm mail id

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • moviemedic
    Sergeant Major

    • Jun 2006
    • 94

    FMP code for validating your emailid is same as confirm mail id

    I have a working form that can be found at:


    I should be thankful it is working. What I am wanting to do is make sure the email field and the confirm email match before form can be submitted. At this time the person can put two different emails. I have this snippet of code but I have no idea if it will work or where to put it.

    if (d.email.value!=dc.value) { alert("Your email and Confirm emaildoesn't match.."); d.cemail.value=""; d.cemail.focus(); return false; }

    I tried inserting in my form code using dreamweaver but did not work. Maybe I put it in the wrong place.

    Thanks for any help I might receive. I am code challenged!
    moviemedic
    _______________________
    billygorilly.com
    flyingkittenmusic.com
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: FMP code for validating your emailid is same as confirm mail id

    Actually, the code should be:

    if (document._re_Email.value != document._re_Confirm_Email_address.value) {
    alert("The confirm Email address field is different from the Email address. Please edit your input.");
    document._re_Confirm_Email_address.value=""; document._re_Confirm_Email_address.focus();
    return false;
    break;
    }

    Now, if you look at your page code, you will see a Javascript in the between head tag, wher ethe "isValidForm" function is defined. You should edit this function as follows:


    <SCRIPT LANGUAGE = "JavaScript">
    <!--
    function isFilled(str){ return (str != ""); }
    function isEmail(string) { return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1); }
    function isDigital(str) { return(parseFloat(str,10)==(str*1)); }
    function isCurrency(val) { var re = /^(\$?\d+\$?|\$?\d+\.\d+\$?)$/; return (re.test(val)); }
    function ValidForm(form) {
    var field, i;
    var req = new Array(11);
    var email = new Array(2);
    var digits = new Array(0);
    var currs = new Array(0);
    req[0] = "rw_First_Name";
    req[1] = "rw_Last_Name";
    req[2] = "rw_School_Library_Name";
    req[3] = "rw_Address_1";
    req[4] = "rw_City";
    req[5] = "rw_State_";
    req[6] = "rw_Postal_Code";
    req[7] = "rw_Phone";
    req[8] = "re_Email";
    req[9] = "re_Confirm_Email_Address";
    req[10] = "rw_Purchase_Order_Number";
    email[0] = "re_Email";
    email[1] = "re_Confirm_Email_Address";
    for (i=0;i<11;i++) {
    var field = document.getElementById(req[i]);
    if ((field.type == 'checkbox')||(field.type == 'radio'))
    {
    var field = document.getElementsByName(req[i]);
    var chk = false;
    for(l=0;l<field.length;l++)
    {
    if (field[l].checked) chk = true;
    }
    if (!chk) {alert("Field '" + field[0].title + "' is required to be checked correctly before successful submission."); return false; break;}
    }
    else
    {
    if (!isFilled(field.value)) {
    alert("Field '" + field.title + "' is required to be filled in before successful submission.");
    field.focus();
    return false;
    break;
    }}}
    for (i=0;i<2;i++) {
    var field = document.getElementById(email[i]);
    if (!isEmail(field.value)) {
    alert("Field '" + field.title + "' is required to be filled in with valid email addresses before successful submission.");
    field.focus();
    return false;
    break;
    }}
    for (i=0;i<0;i++) {
    var field = document.getElementById(digits[i]);
    if (!isDigital(field.value)) {
    alert("Field " + field.title + " is required to be filled in only with digits (0-9) and decimal point before successful submission.");
    field.focus();
    return false;
    break;
    }}
    for (i=0;i<0;i++) {
    var field = document.getElementById(currs[i]);
    if (!isCurrency(field.value)) {
    alert("Field " + field.title + " is required to be filled in only with digits (0-9) a decimal point, or a dollar sign before successful submission.");
    field.focus();
    return false;
    break;
    }}

    if (document._re_Email.value != document._re_Confirm_Email_address.value) {
    alert("The confirm Email address field is different from the Email address. Please edit your input.");
    document._re_Confirm_Email_address.value=""; document._re_Confirm_Email_address.focus();
    return false;
    break;
    }
    return true; }

    Didn't test it but should work
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • moviemedic
      Sergeant Major

      • Jun 2006
      • 94

      #3
      Re: FMP code for validating your emailid is same as confirm mail id

      Navaldesign,
      thanks for the reply. I just tried your suggestion. I copied and pasted the code you supplied and I could still send form with 2 different emails. Not sure where the glitch is.
      moviemedic
      _______________________
      billygorilly.com
      flyingkittenmusic.com

      Comment

      • moviemedic
        Sergeant Major

        • Jun 2006
        • 94

        #4
        Re: FMP code for validating your emailid is same as confirm mail id

        Oh, another thing I just noticed is the alert email that is sent to me only supplies the confirm email address. The first email field is blank. ?
        moviemedic
        _______________________
        billygorilly.com
        flyingkittenmusic.com

        Comment

        • moviemedic
          Sergeant Major

          • Jun 2006
          • 94

          #5
          Re: still need help with form

          This is the code navaldesign graciously shared with me. I tried it and it still let me input 2 different emails. My goal is to make sure my guest signing my form input the same email in both fields email and confirm email. As it is now there can be two different emails sent in. There must be a glich somewhere but I can't find it. Not sure where my error is. Any help appreciated.
          The form can be found at




          <SCRIPT LANGUAGE = "JavaScript">
          <!--
          function isFilled(str){ return (str != ""); }
          function isEmail(string) { return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1); }
          function isDigital(str) { return(parseFloat(str,10)==(str*1)); }
          function isCurrency(val) { var re = /^(\$?\d+\$?|\$?\d+\.\d+\$?)$/; return (re.test(val)); }
          function ValidForm(form) {
          var field, i;
          var req = new Array(11);
          var email = new Array(2);
          var digits = new Array(0);
          var currs = new Array(0);
          req[0] = "rw_First_Name";
          req[1] = "rw_Last_Name";
          req[2] = "rw_School_Library_Name";
          req[3] = "rw_Address_1";
          req[4] = "rw_City";
          req[5] = "rw_State_";
          req[6] = "rw_Postal_Code";
          req[7] = "rw_Phone";
          req[8] = "re_Email";
          req[9] = "re_Confirm_Email_Address";
          req[10] = "rw_Purchase_Order_Number";
          email[0] = "re_Email";
          email[1] = "re_Confirm_Email_Address";
          for (i=0;i<11;i++) {
          var field = document.getElementById(req[i]);
          if ((field.type == 'checkbox')||(field.type == 'radio'))
          {
          var field = document.getElementsByName(req[i]);
          var chk = false;
          for(l=0;l<field.length;l++)
          {
          if (field[l].checked) chk = true;
          }
          if (!chk) {alert("Field '" + field[0].title + "' is required to be checked correctly before successful submission."); return false; break;}
          }
          else
          {
          if (!isFilled(field.value)) {
          alert("Field '" + field.title + "' is required to be filled in before successful submission.");
          field.focus();
          return false;
          break;
          }}}
          for (i=0;i<2;i++) {
          var field = document.getElementById(email[i]);
          if (!isEmail(field.value)) {
          alert("Field '" + field.title + "' is required to be filled in with valid email addresses before successful submission.");
          field.focus();
          return false;
          break;
          }}
          for (i=0;i<0;i++) {
          var field = document.getElementById(digits[i]);
          if (!isDigital(field.value)) {
          alert("Field " + field.title + " is required to be filled in only with digits (0-9) and decimal point before successful submission.");
          field.focus();
          return false;
          break;
          }}
          for (i=0;i<0;i++) {
          var field = document.getElementById(currs[i]);
          if (!isCurrency(field.value)) {
          alert("Field " + field.title + " is required to be filled in only with digits (0-9) a decimal point, or a dollar sign before successful submission.");
          field.focus();
          return false;
          break;
          }}

          if (document._re_Email.value != document._re_Confirm_Email_address.value) {
          alert("The confirm Email address field is different from the Email address. Please edit your input.");
          document._re_Confirm_Email_address.value=""; document._re_Confirm_Email_address.focus();
          return false;
          break;
          }
          return true; }
          moviemedic
          _______________________
          billygorilly.com
          flyingkittenmusic.com

          Comment

          Working...
          X