Wappler Version : 6.8.0
Operating System : Windows 10 Pro
Server Model: Node.js
Database Type: Postgres
Hosting Type: Local
Expected behavior
When submitting a form, I created a field validation step (Validate Data). For a numeric field, I defined a minimum value rule (Min) of "0" to prevent negative numbers. I also set a required field rule (Required) to avoid empty values. Therefore:
For values >= 0, the field is valid.
For values < 0, the field is invalid (Min rule). Message: "This field cannot be negative"
For empty values, the field is invalid (Required rule). Message: "This field is required"
Actual behavior
The Min rule does not allow empty values, displaying the validation message before the Required rule. Thus, when submitting the form with an empty numeric field, instead of displaying "This field is required", the error message shown is "This field cannot be negative." The Min rule should validate numbers and not the absence of a value. This validation is the job of the Required rule.
How to reproduce
- Create a form with a numeric field;
- In the form processing server API, add a Validate Data step;
- Create a validation rule for the numeric field to prevent negative numbers (Min);
- Create a validation rule for the numeric field to make it required (Required);
- Submit the form with the field in question left empty.
BONUS TRACK
When a Min validation rule is set with the value "0", the value does not appear in the UI after being saved—only values different from 0 do.