We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38441
    • 140 Posts
    I'm a newbie, making progress using an install of revo 2.2.0pl and my latest hurdle in developing my first website with this is in setting up contact forms using formit 2.0.3pl
    I have followed this tut-
    http://codingpad.maryspad.com/2011/03/08/modx-revolution-for-complete-beginners-part-9-using-formit-for-contact-forms/comment-page-1/#comment-13011

    But at the point of validating form fields, it states that validation error messages automatically appear in red text, and that these can be accessed in the manager via-

    "Lexicon under formit. Go into System->Lexicon Management, and then change the Namespace from the default “core” to “formit” and you will see them all listed there."

    My problem is that whilst i can see this in 'system', what am i supposed to do with it if anything, and the form field validation errors do not appear in red as stated. I've spent the last 10 hours to get as far as displaying a single error message at the top of the form if fields are missed out, however the text displays in black and the background in my page design is also black... is there anyway to style this validation error message such as change it's color?

    Lastly, on the auto-responder message that sends to the user who filled out the form, that message go's straight into junk folders.. Is there anyway to reduce the possibility of this happening?
      • 16348
      • 64 Posts
      You can edit the way the error is displayed with the property "errTpl". The default template wraps the error message with a span-tag which has the css-class "error" attached to it. If this is sufficient for your design, all you have to do is style the class "error" in your stylesheet to show it in red text (or whatever you want). For more info about the available properties see http://rtfm.modx.com/display/ADDON/FormIt#FormIt-HowtoUse

      Regarding your question about the lexicon topics, this is a place where you can change the text for the actual error messages if you want to.

      My only suggestion for your last question is to try to tweak your email template to look a little more "humanwritten".
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You can also prevent this by making sure to have all the various From, Reply-to etc fields specified.
          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
          • 38441
          • 140 Posts
          Thanks for both your comments. I did try to add the css-class of error in my style sheet just to change the colour of the message, but didn't appear to work.. & for some reason, although i've added the 'from' email address (&emailFrom=" "), when a copy of the form message sends to the person who entered their details, it appears as 'unknown' sender.. landing it in junk folders.

            • 16348
            • 64 Posts
            You can't use quotation marks (") in your snippet calls, use grave accents (`) instead.

            Are you using the FormItAutoResponder hook? In that case the properties are "fiarFrom" and "fiarFromName", see http://rtfm.modx.com/display/ADDON/FormIt.Hooks.FormItAutoResponder. The property "fiarFrom" defaults to the system setting "emailsender". The best is to set this setting to a good default value.

            When it comes to the error messages, look in the html source (after a validation error) to see how the error message is displayed and then change your css according to that.
              • 38441
              • 140 Posts
              Sorry, it was how i wrote the forum post, i didn't use quotation marks in my actual code. I've taken the above points into account and amended/ added new entries as listed below. However, the auto-responder message sent to the user who completed the form still lands in their junk mail.. & feel like i've tried every suggestion..

              [[!FormIt?
              &hooks=`email,redirect,spam,FormItAutoResponder`
              &emailFrom=`[email protected]`
              &emailFromName=`[email protected]`
              &emailReplyTo=`[email protected]`
              &emailReplyToName=`[email protected]`
              &emailTpl=`sentEmailTpl`
              &emailSubject=`Message from Website Contact Form`
              &emailTo=`[email protected], [email protected]`
              &validate=`contact_name:required,
                    contact_email:email:required,
                    contact_message:required,
                    contact_phone_NA_format:required,
                    your_county:required,
                    referal:required,
                    contact_message:required`
              &validationErrorMessage=`*Please Complete All Fields`
                 &redirectTo=`25`
              &fiarTpl=`autoResponseTpl`
              &fiarSubject=`Thank You for Contacting Us`
              &fiarToField=`contact_email`
              &fiarFromName=`ABC`
              &fiarFrom=`[email protected]`
              &fiarReplyTo=`[email protected]`
              &fiarReplyToName=`ABC`
              ]]


              Regarding the error message, when i view source code it appears simply as a line of text not having been wrapped in anything at all such as a <p> tag, the message appears to be pulled from the line above-

              &validationErrorMessage=`*Please Complete All Fields`

              & i'm not sure how to get at it if that makes sense, so that i can control it's appearance such as changing it's color at least.
                • 38441
                • 140 Posts
                I've since managed to fix the error message (i just wanted to style it), by placing html tags around this- [[!+fi.validation_error_message]]
                Total oversight on my part as i hadn't noticed this. Doh!
                & the fact that auto-responder emails from the form to form user lands in their junk mail, could this possibly be down to the fact the site is currently operating on a temporary domain using i.p address/~username?
                I shall see when it's finally published live using the real domain.

                Thanks again for comments, they helped me to work thru this. I find many concepts in modx difficult to get my head round to start with but the support is fantastic!