[Plugin: Contact Form 7] wpcf7_validate_text is working but 'reason' text is coming blank.
-
Hi,
I have added this filter on wpcf7_validate_text, It works well but unable to show any text, it shows just blank text box next to the field and result-box with standard validation error.
// Add custom validation for CF7 form fields function custom_text_validation_filter($result,$tag){ $type = $tag['type']; $name = $tag['name']; if($name == 'page_url'){ // Only apply to fields with the form field name of "page_url" $the_value = $_POST[$name]; if($the_value !== 'www.google.com'){ // Sample test. $result['valid'] = false; $result['reason'][$name] = 'This facebook page doesn\'t exist.'; } } return $result; } add_filter( 'wpcf7_validate_text', 'custom_text_validation_filter', 10, 2 ); // text field add_filter( 'wpcf7_validate_text*', 'custom_text_validation_filter', 10, 2 ); //Req. text field.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: Contact Form 7] wpcf7_validate_text is working but 'reason' text is coming blank.’ is closed to new replies.