7 Replies Latest reply on Jan 15, 2015 5:01 PM by Takehiro Monday

    Adding custom form validation

      I need to make a small JavaScript/jQuery can compare the two input fields. I was led to believe thsi could be done by editing custom form validation. Where can I find this? How do I do this? 
        • Re: Adding custom form validation
          Check out the Forms documentation, and in particular example 4 on the page:
          • Re: Adding custom form validation
            Thanks Murtza,

            I cannot edit the embeded code. The window pops up and shows the Javascript. Howerer, it will not let me edit to. 

            How can I now edit the Javascript now that I have found it?
            • Re: Adding custom form validation
              You would have to add your custom JavaScript on the page that checks for when the form loads and then implement changes there. 
              • Re: Adding custom form validation
                Ahh! Im confused :-/

                To be clear, I want to trap this invalid email error on the page that I am on (before I go to the follow up page). I want the JavaScript to to call upon this email validation function as the user presses Submit.

                I have a feeling it would look like this (see below)....an if/esle statement...but I do not know how to get into the form's code to edit it....

                can you offer some advice?

                <script type="text/javascript"> 
                function checkEmail() { 
                   var e1 = document.getElementById('Email').value; 
                   var e2 = document.getElementById('confirmEmailAddress').value; 

                   if (e1 != e2) { 
                      return true; 
                     alert('Please verify the email address!'); 
                    return false; 

                and set the additional attribute of the submit button to
                onsubmit=" return checkEmail('email1','email2');"

                • Re: Adding custom form validation
                  Takehiro Monday
                  Hi Matt

                  I am using custom validation.
                  My steps is below.
                  1.Select "Embed Code"

                  2. Copy Embed Code

                  3. Past code at Landing Page HTML Element and Edit it.


                  • Re: Adding custom form validation
                    Thank you Takehiro

                    So what you are saying is that this change needs to be made on the landing page, not the form itself? 

                    I ask because the LP will not be a Marketo landing page and I will need to give this job to someone else. 
                    • Re: Adding custom form validation
                      Takehiro Monday
                      Unfortunately, we can not edit embed code in Forms2.0 directly.
                      It is read only.
                      But embed code run on other CMS.
                      Someone can edit embed code on your company's CMS also.