We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20776
    • 36 Posts
    Hello everbody,

    I’m a news user of Modx, and i have a question.

    I use a eform with a validation : #RANGE 1900-2000

    I’d like to put the validation rule number in a chunks, for a better manadgement:
    I’ve put 1900-2000 in a chunk called "code", but now my validation doesn’t work

    <div class="inputline">
    <label for="Code">Le code:</label>
    <input type="text" class="forminput" name="Code" size="20" maxlength="15" eform="Code:integer:1:Error Code:#RANGE {{code}}" />
    </div>

    If you know how call a chunk (or snippet), in the input tag?

    thanks,

    mylullul
      • 27376
      • 576 Posts
      From what I can tell, that code looks fine, perhaps you’ve found some limitation of eForm not parsing Chunks inside a chunk?

      Does the validation work with you putting the validation rule in WITHOUT the use of a chunk?
        • 30223
        • 1,010 Posts
        I’m not surprised your validation doesn’t work.... This (adding chunks inside the form chunk like you did) is not possible with eForm.

        Recursively replacing chunk tags with their values is a function of the MODx document parser. eForm has nothing to do with that. By the time eForm kicks in your little ’range chunk’ has not been available to the document parser yet and by the time eForm has finished it would be too late anyway.
        In fact your chunk would never be seen at all as eForm strips out the eform attribute as soon a it has parsed your form.
          • 20776
          • 36 Posts
          thanks for the reply

          Quote from: sirlancelot at Jan 07, 2007, 08:01 AM

          Does the validation work with you putting the validation rule in WITHOUT the use of a chunk?

          yes the validation works fine...


          Quote from: TobyL at Jan 07, 2007, 09:20 AM

          I’m not surprised your validation doesn’t work.... This (adding chunks inside the form chunk like you did) is not possible with eForm.

          Recursively replacing chunk tags with their values is a function of the MODx document parser. eForm has nothing to do with that. By the time eForm kicks in your little ’range chunk’ has not been available to the document parser yet and by the time eForm has finished it would be too late anyway.
          In fact your chunk would never be seen at all as eForm strips out the eform attribute as soon a it has parsed your form.
          [/quote

          thanks for the explication

          if i find a solution, i’ll post it
            • 20776
            • 36 Posts
            another way, is it possible to use a template variable in a chunk?
              • 30223
              • 1,010 Posts
              Same restrictions apply... from within eForm TV’s are "invisible". If the TV tags are not stripped out by eForm they would become visible to the document parser AFTER eForm has finished executing. (This depends where the TV is placed - if inside the eform attribute they would be stripped for sure)