I need to validate just one field (called ‘Instance’) to accept lowercase ASCII letters and numbers only, the first character also has to be a letter not a number. It will accept uppercase characters but we will need it to lowercase them on input. So if someone uses the instance name McDonalds it will be lowercased to mcdonalds (not just with CSS). Spaces are not allowed either.
Is this possible with CF7? If so please explain how.
I’ve already tried this custom validation method but even with the preset custom validation in the file it was just displaying the field shortcode rather than the field itself.
Thanks
From contactform7.com on Custom Validation â Validation as a Filter:
// Add custom validation for CF7 form fields
I had a similar issue for validating name fields, I added the following code in my functions.php, you could customize it by changing the regex
Please use this wordpress plugin
Jquery Validation For Contact Form 7
https://wordpress.org/plugins/jquery-validation-for-contact-form-7/
You can add your own custom validation for a form field input by using the
add_filter
function.For adding a custom validation for a
textarea
field you can add the following insidefunctions.php
file in the root directory of your theme.For me the trick was to cast the
$result
parameter to an object, because theinvalidate
method that is used to add the error message didn’t work before casting.Try this plugin. It’s allow to set custom validation message for each field in free version.
URL : https://wordpress.org/plugins/cf7-custom-validation-message/