We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43888
    • 19 Posts
    hi there,
    i have a form page with formit, and it works fine and the field validation and validation error are correctly handled and displayed.

    this page content is really complex, so i wanted to iprove it using chunks and snippets, but i'm having an issue i can't solve by myself.

    the idea is something like this:

    [[!FormIt?
    &customValidators=`bla bla bla` other bla]]
    
    [[!mysnippet? &param=`[[!+fi.error.myfield]]`]]


    inside mysnippet i want to read the placeholder [[!+fi.error.myfield]] and, if it's a an empty string, do something, if it's not do something else.
    apparently it's never an empty string, because if i debug i find that, if the placeholder contains an error message and therefore the string is empty, it works fine, if the placeholder is empty mysnippet sees this string in the variable:[[!+fi.error.myfield]]

    given that formit is called before mysnippet i would have expected it to work fine.
    i tried with 2 simple snippets and it works great, so i can't understand what i'm doing wrong.
    thanks for your help

    p.s. modx 2.2.6 and formit 2.2.0
    • Could an output filter do the job of your snippet?
      http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/input-and-output-filters-%28output-modifiers%29

        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 43888
        • 19 Posts
        i tried, but i have the same behavior.

        the idea is that, if i have an error message for the validated field, i have a whole portion of html that i want to omit if the field is fine.

        so i tried with [[+param:notempty=`<tag><anothertag><7anothertag></tag>`]] but it always outputs the html, because he thinks the string i passed is "[[!+fi.error.myfield]]" and not the content of [[!+fi.error.myfield]].

        any other idea?