FEATURE REQUEST: New validation rule similar to declined_if #41172
Unanswered
kitihounel
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I think it will be useful to add a new validation rule similar to declined_if.
To quote the doc of declined_if: The field under validation must be "no", "off", 0, or false if another field under validation is equal to a specified value.
The new validation rule should forbid a value (or certain values) for the field under validation if another field has a value (or certain values).
The syntax could be:
forbidden_if:<forbidden value>,<other field>,<other field value>
Use case
Suppose that we have a page that does arithmetic operations (add, minus, mul and div) and accepts the two operands (
a
andb
) and the operator (op
) via POST. For the division operation, the second operand should not be null. So the validation rules should be:I looked in the validation rules available, and there no rule that does that.
Beta Was this translation helpful? Give feedback.
All reactions