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
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?
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.
another way, is it possible to use a template variable in a chunk?
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)