We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    I have a textarea, that in a perfect world, I would like be required to contain some text yet have that text not be more than 1,000 characters.

    I did this:
    $validate=
    bodymessage:required,
    bodymessage:maxLength=^1000^,

    It seems to work, but only once. If too long of text is deleted completely, the required aspect of the textarea validation does not get triggered.
    I'm guessing that since there are two validations on the same field, the last one entered takes priority.

    Is there another way to solve this? Or do I need to pick the most important thing that I want validated?

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

    • discuss.answer
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      Quote from: mmcgee at Jul 23, 2015, 08:46 PM


      I did this:
      $validate=
      bodymessage:required,
      bodymessage:maxLength=^1000^,


      I am going to assume the $ is a typo, but if not you'll want to change that to & and add the maxLength to the single validation.
      &validate=
      `bodymessage:required:maxLength=^1000^`


      Also, don't forget the backticks.
        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
        • 19872
        • 1,078 Posts
        Long time no see!
        Yes. $ was typo. Being able to combine the validators into a single validation is very helpful.

        Thank you!


        Quote from: frogabog at Jul 24, 2015, 03:09 AM
        Quote from: mmcgee at Jul 23, 2015, 08:46 PM


        I did this:
        $validate=
        bodymessage:required,
        bodymessage:maxLength=^1000^,


        I am going to assume the $ is a typo, but if not you'll want to change that to & and add the maxLength to the single validation.
        &validate=
        `bodymessage:required:maxLength=^1000^`


        Also, don't forget the backticks.
          • 10208 ☆ A M B ☆
          • 1,780 Posts
          Aye, yet still pluggin' away :~}

          Nice to see you too Marc. Got my own formIt issues https://forums.modx.com/thread/95882/formit-doesn-t-like-in-emailto-field#dis-post-528758

            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
            • 19872
            • 1,078 Posts
            My brain is not fully functioning yet as I've only had one cup of coffee... but in rereading that post, I'm having a hard time understanding what the goal is.

            Is the goal to have a form only load on a specific resource, and have the emailTo populated with the email address stored in the system settings?

              • 10208 ☆ A M B ☆
              • 1,780 Posts
              Quite honestly, it's just for testing purposes for me but formIt, for all intents and purposes should always take an email in the parameters if you ask me, regardless of if the template is filtering multiple options containing [[*content]] or not.

              I have the [email protected] populating the [[++mainEmail]] (ClientConfig) for long term purposes, which works. But I wanted to test it with my own email and that's when it gorked.
                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