Validation not working on manually added fields
-
Hi, I’m working on a plugin that requires custom validation but I can’t seem to get the validation to work with input fields that have been added manually
<input type="text" name="my_validation" />
rather then the CF7 standard
[text my_validation]
I have my input fields being added to the form through a custom shortcode, is there anything I have to do to my shortcode to have my input fields recognized by the CF7 validation?
Here is a portion of my code below
function cf7ic_check_if_spam($result, $tag) { if($_POST['cf7ic_exists']) { if ($tag['type'] == 'radio' && $tag['name'] == 'kc_captcha' && !empty($_POST['kc_honeypot']) || $_POST['kc_captcha'] != "kc_human" ) { $result['valid'] = false; $name = 'kc_captcha'; $result->invalidate( $name, "Please select an icon." ); } return $result; } // Allow Contact Forms without [cf7ic] to send if($_POST['cf7ic_exists'] != "true") { return $result; } } add_filter('wpcf7_validate_radio', 'cf7ic_check_if_spam', 10, 2);
And this is part of the code that outputs my radio buttons
<label><input type="radio" name="kc_captcha" value="'. $value .'"/><i class="fa '. $image .'"></i></label>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Validation not working on manually added fields’ is closed to new replies.