We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44406
    • 11 Posts
    Hi there,

    This works in my FormIt snippet:

    &successMessage=`<h3>Thank you for contacting us.</h3>`

    But this makes the whole form disappear:

    &successMessage=`<h3>Thank you for = contacting us.</h3>`

    I'm trying to add an html class to the h3 tag (e.g. <h3 class="msg">) but it breaks FormIt.

    But this tutorial http://www.cmstricks.com/blog/2013/03/21/modx-form-submission-with-formit/ has html classes and the demo works.

    Here is my complete snippet call:

              [[!FormIt?
                 &hooks=`recaptcha,spam,email`
                 &emailTpl=`contact.email`
                 &emailTo=`[email protected]`
                 &emailSubject=`Contact form from Roccia Machinery website`
                 &validate=`
                    name:required,
                    company,
                    email:email:required,
                    telephone,
                    message:stripTags`
                 &successMessage=`<h3>Thank you for = contacting us.</h3>`
              ]]

    Thanks,

    David

    This question has been answered by Nebulous. See the first response.

      • 44234
      • 219 Posts
      Does using an escaped entities make any difference?
      http://www.poynton.com/notes/Internet/Escaped_entities.html
        Find me on Twitter, GitHub or Google+
        • 44406
        • 11 Posts
        It breaks, but in a different way; I just get a ` where the form should be.

        Interestingly, = is fine if I run the FormIt snippet uncached (without the !). But although the form displays, it doesn't send an email.

        If it helps, I'm running the whole FormIt snippet and form within its own chunk.

        Thanks,

        David
          • 37105
          • 194 Posts
          Just curious: why not using a chunk for the message and call this chunk in &succesMessage ? Does that break your FormIt call also?
            Codeplaza Webdesign: for professional websites at low cost
            • 44406
            • 11 Posts
            Same thing happens. Form doesn't display if I put = into the chunk.
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              FormIt itself doesn't do anything if the snippet call is cached; the first display of the page will show the form, but it gets cached at that point and the snippet tags are lost, so on form submit (the second page request, taken from the cache) nothing happens, since there's no snippet to process the POST sent along by the form.

              The only way an error with FormIt will cause the form itself to not display is if the error causes the whole page to abort. You can display forms all day without any FormIt snippet at all.

              Have you tried using an HTML entity instead of the = character?
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 44234
                • 219 Posts
                Try applying this output filter to the chunk:
                [[$successMessageChunk:htmlent]]
                  Find me on Twitter, GitHub or Google+
                • discuss.answer
                  • 21078
                  • 77 Posts
                  Hm, you could try it with a custom hook. Maybe this works?!

                  FormIt:
                  [[!FormIt? &hooks=`recaptcha,spam,email,mySuccessMsg` ... ]]


                  Snippet (mySuccessMsg):
                  <?php
                  $modx->setPlaceholder('mySuccessMsg','<h3 class="msg">Thank you for contacting us.</h3>');
                  return true;
                  ?>


                  Placeholder (below FormIt tag):
                  [[+mySuccessMsg]]
                    L.net Web Solutions
                    Professional webdesign and development with MODX and WordPress.
                    • 44406
                    • 11 Posts
                    sottwell: If I use = then I just get a ` (the rest of the page displays).

                    David Pede: The form wasn't displayed, but at least I didn't get a ` in its place.

                    Chris: I'd seen this suggestion elsewhere, but thought it seemed like overkill. It may well be, but it works. The quicker alternative was to put the h3 inside the form tag (there was only one), but I'm going to stick with the extra snippet implementation because I might need it for longer forms in the future.

                    Thanks,

                    David