Message validation
-
Hello,
Is it possible to add additional message validation to the form?
I want the form to throw an error if the message contains a URL. For my other sites, which use contact form 7, it uses the ‘Disallowed Comment Keys’ field in the Discussion settings of WordPress and for sites using gravity forms I have used a filter to hook into field validation as shown below.Is it possible to do something similar with this form plugin?
Thanks
Jo
Gravity forms validation:
// add custom validation to form add_filter( 'gform_field_validation_1_4', 'validate_1_4', 10, 4 ); function validate_1_4( $result, $value, $form, $field ) { $nourl_pattern = '(===|http|https|www)'; if ( preg_match( $nourl_pattern, $value ) ) { $result['is_valid'] = false; $result['message'] = 'Message can not contain special characters or website addresses.'; } return $result; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Message validation’ is closed to new replies.