SWV Enum rule fails for checkboxes, radio buttons with surrounding whitespace
-
Upgrade to 6.0 introduces a validation error thrown for radio buttons with (intended) whitespace surrounding specific radio items.
From what I can see is that within Schema Woven Valdiation rule ‘enum’ (
contact-form-7/includes/swv/php/rules/enum.php
), the incoming $input still has the whitespace (in my case, a “ ” at the beginning), which is then removed bywpcf7_strip_whitespaces( $input );
in line 24.
However, $acceptable_values has the whitespace (which I think is correct and preferred, as it’s a radio value defined by intent).Therefore the following loop to check for accepted values fails and throws the corresponding ‘unknown value’ validation error.
In order to not break existing forms and validations (causing a lot of work in later stages of form data use) , I suggest to
(a) either omit to strip whitespace (which may interfere with https://contactform7.com/2024/07/13/consistent-handling-policy-of-surrounding-whitespaces/ )
or
(b) have a temporarywpcf7_strip_whitespaces( ... )
also on accepted values, so that anything that fits stripped values on both sides is accepted without validation error.Thank you for considering this suggestion.
- You must be logged in to reply to this topic.