We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41149
    • 43 Posts
    Well here is the deal I am trying to implement an error message is the validation fails and it is outputting this:

    1


    Here is my call to FormIt.

    [[!FormIt? 
    &hooks=`email,redirect` 
    &emailTpl=`sentEmailTpl` 
    &emailSubject=`Nox Innovations - Contact Form` 
    &emailTo=`[email protected]` 
    &validate=`contact_name:required:minLength=^2^, 
    contact_email:email:required, 
    contact_message:required, 
    contact_phone:required:minLength=^10^ `
    &redirectTo=`2` ]]


    Here is my simple call...

    [[!+fi.validation_error]]

    -and/or-
    [[!+fi.validation_error_message]]


    All I get is a: 1.

    Yes, I have defined these in my Lexicon Settings under the Formit NameSpace.

    Any ideas?

    Thanks!

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

      The web is our sandbox, so let's develop a castle.
    • discuss.answer
      • 1778
      • 659 Posts
      Hello

      Read deeper the rtfm !

      A general error message for validators, useful if no errors are showing but validation is failing, is used with the following placeholder:
      [ [!+fi.validation_error_message] ]
      This will contain a validation error message, which can be set using the &validationErrorMessage property,and using [ [+errors] ] in the property value, which will be replaced by all the field errors.

      Also, there is a 1/0 placeholder as well:
      [ [!+fi.validation_error] ]

      So your 'general' validation error message must be set using "&validationErrorMessage = `your message` " and use [ [!+fi.validation_error_message ] ] (minus spaces) to display it.
      The placeholder [ [!+fi.validation_error] ], just returns one or zero to indicate if validation failed or not...

      If you want individual error message for each field in error you have to use a placeholder like [ [ !+fi.error.text ] ] (minus spaces) where 'text' is the name of your field...
      Hope this helps
      Cheers
        • 41149
        • 43 Posts
        Thank you, anso. This solved my problem.
          The web is our sandbox, so let's develop a castle.
          • 1778
          • 659 Posts
          Glad you have it to work ^_^
          Cheers