May 18th, 2016, 1:30 PM
(This post was last modified: May 18th, 2016, 1:34 PM by michatmaster7.)
Hey guys -
Not sure if this can be done with reg_exp or not, but I'd like to create a PHP validation rule that is exactly the opposite of same_as. For example, on a form, the customer is allowed to choose their 1st choice and their 2nd choice, but I don't want to let them choose the SAME choice in both fields. Each of the 1st and 2nd choices needs to be different from each other. Any thoughts?
B
I can see in the validation.php file where the same_as rule is written, and I could easily just create another case in that file, but I want to make sure it never gets overwritten (you know, like a WP child theme's functions.php).
/global/code/validation.php:367-370
Not sure if this can be done with reg_exp or not, but I'd like to create a PHP validation rule that is exactly the opposite of same_as. For example, on a form, the customer is allowed to choose their 1st choice and their 2nd choice, but I don't want to let them choose the SAME choice in both fields. Each of the 1st and 2nd choices needs to be different from each other. Any thoughts?
B
I can see in the validation.php file where the same_as rule is written, and I could easily just create another case in that file, but I want to make sure it never gets overwritten (you know, like a WP child theme's functions.php).
/global/code/validation.php:367-370
PHP Code:
case "same_as":
if ($fields[$field_name] != $fields[$field_name2])
$errors[] = $error_message;
break;