Forms are validated with js before submit. Some variables in this script are set dynamically depending the value of custom system settings and lexicon values.
This is the modx template :
<head>
[[...]]
<script>
message = "[[%language_entry]]";
min_length = [[++username_min_length]];
alert ( message + "The password must be at least " + min_length + " characters long.");
</script>
[[...]]
</head>
and this is the result :
<head>
[[...]]
<script>
message = "Oops, some fields are invalid !"; // <== lexicon tag was replaced
min_length = 6; // <== custom system setting was replaced
alert ( message + "The password must be at least " + min_length + " characters long.");
</script>
[[...]]
</head>
That works like a charm when the js is called inline directly in the template, the lexicon entry is replaced by its value, the system setting too.
But because it’s better to have scripts stored as files that will not pollute the html source, or even better, as a modx document, I’ve pasted the script into a new modx document and set content type = javascript and content disposition = attachment.
Now It’s as if I had the script on a file on the server, but when opened in a text editor, I can see that only the system setting has been replaced, not the lexicon tag that remains unchanged (just the [[% ]] are removed):
<head>
[[...]]
<script>
message = "language_entry"; // <== this is not good
min_length = 6;
alert ( message + "The password must be at least " + min_length + " characters long.");
</script>
[[...]]
</head>
I’ve tried several times with cached or uncached tags, or desactivated cache globaly.