You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The prefixing "=" was due to the extra "=" after :isDate. Instead of breaking the validation, it got added to the input value. Something similar happened because of a line break at the end of the validation rule.
The text was updated successfully, but these errors were encountered:
patrickatwsrn
changed the title
idDate Validator prefixes valid values with a "=" after submit
idDate Validator changes valid values after submit
May 25, 2021
patrickatwsrn
changed the title
idDate Validator changes valid values after submit
idDate Validator changes valid values after submit (solved!)
May 25, 2021
Before you read this...
Never copy your old errors into a new project!
The prefixing "=" was due to the extra "=" after :isDate. Instead of breaking the validation, it got added to the input value. Something similar happened because of a line break at the end of the validation rule.
Don't use linebreaks like I did:
Insterad of:
Use
Don't put the comma BEFORE the next line, but put it AFTER you validation rule.
If you don't do that, the linebreak gets transfered into a magic empty space character that is added to the original value.
*** Question *** I might be wrong here, but this should not break the validation and therefore it would be great to fix it.
Bug report (obsolute)
Using
date:isDate==^%Y-%m-%d^
as a validation contrain results in a change of the original variable.
Summary
Quick summary what's this issue about.
Step to reproduce
Testcase: A simple form that requires input for the fields "date" and "name" and also validates "date" to be a valid Date.
Observed behavior
This form expects name and date to be mandatory and date have this form YYYY-MM-DD
Example 1a: Enter values and hit submit
Enter a valid date "2020-12-12" but leave name empty.
Example 1b: Show the form again if the validation failed.
The form gets reloaded and the former values get inserted again.
As you can see a "=" is prefixing the date.
This happens ONLY if the validation was successful! If you enter an invalid date, the validator returns the original values.
Example 2a: Enter values and hit submit
2020-31-12 is not a valid date, because MM can only between 01 and 12.
Example 2b: Show the form again if the validation failed.
The validation for date failed. The value is returned, but it is not prefixed by a "="
Edit:
Where not to look for a solution
There is nothing here, that could explain this.
Expected behavior
The validtor should alway return the original value. The value should not be modified in any way.
Environment
MODX 2.8.1, Formit 4.2.6 , PHP 7.4.18, Apache Webserver Running on Ubuntu Linux.
The text was updated successfully, but these errors were encountered: