validate multiple fields at the same time
Hello Ray,
I have a form with 5 fields that have a default value of 0 (zero).
I need to throw an error when all 5 fields are not set or are equal to 0.
No error should be displayed if only one of these field is set.
How can I do this kind of check with WA server validation?
UPDATE: I think I found a solution:
I've set this in the WA server validation server:
Validation type: number
Server variable: ((((isset($_POST["field1"]) && $_POST["field1"] != "0") || (isset($_POST["field2"]) && $_POST["field2"] != "0") || (isset($_POST["field3"]) && $_POST["field3"] != "0") || (isset($_POST["field4"]) && $_POST["field4"] != "0") || (isset($_POST["field5"]) && $_POST["field5"] != "0") || (isset($_POST["field6"]) && $_POST["field6"] != "0")))?$_POST["field1"]:"999")
Format: Inrternational (1 000,00)
Minimum: 0
Maximum: 100
Allow decimals: 0
It seems to work.
But let me know if there is a better and cleaner way to do this kind of validation.
TIA
tony