4 Replies Latest reply on Sep 6, 2013 1:19 PM by 13687

    Form validation not working non-Marketo page

      Well I've searched all through the community here and racked my brain trying to figure this out, but I'm at a loss. I have a very simple Marketo form (email only) on a teaser page of a subdomain and it will not validate. I've placed lots of Marketo forms on pages of my main site and have never had a problem, so I think there may be some sort of conflict with the WP theme on this subdomain.

      Here is the teaser page and form: http://new.symform.com/

      Note that if you click submit it goes through with no validation. Obviously it wouldn't give the field required message since there is some default text in there, but it should give the "not a valid email" message and stop the submit from going through.

      As far as I can tell I've implimented this form exactly as described on this article:http://community.marketo.com/MarketoArticle?id=kA050000000Kyqg&src=

      Like I said, I've done this before on many other pages of my current site. It is also a WP site, but with a different theme, which is why the only thought I have is that there is some sort of conflict. Here is an example of a form on the current site that validates as expected: http://www.symform.com/join-the-revolution/resources/white-papers/best-practices-for-backup-disaster-recovery-for-smbs-white-paper/

      Anybody have any ideas what the conflict is or what I've done wrong?
        • Re: Form validation not working non-Marketo page
          Didn't take a deep look but it looks like you have two JS validations. Perhaps get rid of the first one since it looks like you're using the second one on the page that works?

          First validation code
          <script type="text/javascript">
                              function fieldValidate(field) {
                                /* call Mkto.setError(field, message) and return false to mark a field value invalid */
                                /* return 'skip' to bypass the built-in validations */
                                return true;
                              function getRequiredFieldMessage(domElement, label) {
                                return "This field is required";
                              function getTelephoneInvalidMessage(domElement, label) {
                                return "Please enter a valid telephone number";
                              function getEmailInvalidMessage(domElement, label) {
                                return "Please enter a valid email address";
          • Re: Form validation not working non-Marketo page
            Well, that code is included in the instructions and you can see it on the source of the Marketo landing page: http://ww2.symform.com/NewWebsiteTeaserForm_Form.html

            But I did try removing it just for the heck of it and it still doesn't work.

            The page that works (along with all my forms on my current site) uses an older version of the code that was described in an older version of the how to article. Thinking that might be the problem I tried putting the older version on the new site, and vice versa, and still had the same problem. Works on the old site, not on the new.

            In my inspect element console I do see this error:

            1.           Uncaught ReferenceError: Validator is not defined new.symform.com/:163           
                (anonymous function)new.symform.com/:163

            Validator is the Marketo function that is called, so maybe there is a problem with it getting loaded from the mktFormSupport.js?

            • Re: Form validation not working non-Marketo page
              Well, I figured it out. Even though the field was marked for validation of the email, it wasn't marked as required on the form. Fixed that on the original form, added the required class to the form on my page and now it works. Apparently the email field has to be required in order for it to validate what was entered. Seems kind of strange. While most people will always want email address required, I can imagine a scenario where you don't, but still want to validate it as valid if someone enters something. Anyway, so much headache for such a simple fix. Angry at myself right now.
              • Re: Form validation not working non-Marketo page
                Glad you figured it out. Agree that it's unexpected.

                Anytime you do something that's not supported out of the box though, these things will happen :)