We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28120
    • 380 Posts
    Using FormIt.Example 1 - Contact Page http://svn.modxcms.com/docs/display/ADDON/FormIt.Example+1+-+Contact+Page the code

    <p>[[+fi.error.error_message]]</p>

    doesn’t output any errors?

    Also how can I change the formfield class on error so I can change the border to red?

    Thanks
      • 1778
      • 659 Posts
      As far as I know, it outputs the error messages like "error when sending mail" or errors while processing the form...
      Cheers
        • 28120
        • 380 Posts
        So it does - thanks!

        I was confusing it with the field validation messages.

        That just leaves the 2nd point on how to change the formfield css class to highlight borders in red for error fields.
          • 28554
          • 201 Posts
          You can highlight the fields by adding the following to your code:

          <input type="text" name="fieldname:required" class="large[[!+fi.error.fieldname:notempty=` error`]]" value="[[+fi.fieldname]]" />
          


          Then just add to your stylesheet:

          input.error { border: 1px solid red; }
          
            • 28120
            • 380 Posts
            Perfect thanks

            I couldn’t find this is in the documentation. Is this type of thing documented somewhere so I don’t have to pester you guys?
              • 28554
              • 201 Posts
              Well, it uses output filters (Wiki, which is documented, but besides that it’s using logic smiley. Most add-ons are documented in the Wiki under the MODx Add-ons section.
                • 19513
                • 16 Posts
                For me it doesn’t work. (MODx Revolution 2.0.0-en rev7212)

                this
                [tt][[!+Fi.error.fieldname]][/tt]
                returns the value of error.(This mean that working properly)

                but this
                [tt][[!+Fi.error.fieldname:notempty=`error`]][/tt]
                not return any value. It looks like as empty.

                Maybe my filters are disabled or not installed?
                  Marketing WWW i takie tam: http://www.graphicsite.pl
                • Here is what i use:

                  [[+fi.error.name:isnot=``:then=`class="warning"`]]
                  


                  And it works.
                  I remember that it was buggy when using the notempty output filter.
                    • 19513
                    • 16 Posts
                    Hmmm .... Your solution actually works!!! THX

                    I checked the manual and I’m not found a way such as your:
                    http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters

                    Where did you get this solution? I searched the whole manual... Hmmm?
                      Marketing WWW i takie tam: http://www.graphicsite.pl
                      • 30244
                      • 4 Posts
                      Thanks lossendae for:

                      Here is what i use:
                      [[+fi.error.name:isnot=``:then=`class="warning"`]]
                      


                      I think it’s worth mentioning for newbies like myself where to actually insert this code. Here is an example from my form:
                      <input id="surname" name="surname" type="text" value="[[!+fi.surname]]" tabindex="3" [[+fi.error.surname:isnot=``:then=`class="warning"`]] />* <span class="error">[[!+fi.error.surname]]</span>
                      

                      NB.
                      <span class="error">[[!+fi.error.surname]]</span>
                      prints the default error message: "This field is required." next to the empty field.

                      And I put this in between my style tags:
                      	
                      input.warning {border: 2px solid red}