We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16348
    • 64 Posts
    Another way to do it is to use the errTpl property of FormIt.
    From the FormIt RTFM:
    The wrapper html for error messages. Note: not a chunk, just straight HTML. Default:
    <span class="error">[[+error]]</span>


    Something like this should do it:
    [[!FormIt?
       &hooks=`spam,email`
       &emailTpl=`MyEmailChunk`
       &emailTo=`[email protected]`
       &successMessage=`Thanks for your message.`
       &validate=`name:required`
       &errTpl=`class="error"`
    ]]
    

    <input type="text" id="name" [[!fi.error.name]] />
    


    The downside is that you can't use the text error messages.
    • Ojchris the easiest way to achieve what you want would be using something like this:

      
      [[!+fi.error_message:notempty=`
      <p>[[!+fi.error_message]]</p>
      <ul>
      [[!fi.error.name:notempty=`<li>Name is required</li>`]]
      [[!fi.error.email:notempty=`<li>Email is required</li>`]]
      </ul>`]]
      


      This will display the error message you want at the top and create a list of which fields contain errors, this is untested but in theory it should work.

      Let me know if it works, good luck.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
      • benmarte what can I do whithout you? Thanks this initiates some ideas. Let you how it went.
        • Kristoffer (from Christopher?) Thanks for your response