In wordpress contact form 7, i want to show different error messages for sender must fill in field like “Your name is required”, “Your email is required” instead of common message Please fill the required field. for all the fields in my form,
please share here, if you have any idea.
Thanks in advance.
you can use jquery validation. You can easly implement jquery validation in contact form 7
here is sample code for jquery validation.
PHP code,Link contact form 7
Hope this will helps you.
At the bottom of the contact form page there are a heap of settings where you can adjust which error messages are displayed in different situations.
However, I think if you wanted to show specific messages for a field that have not been filled in, you would need to dequeue the contact form 7 javascript and create your own.
Then I’d recommend copying the script into your theme, enqueing it through functions.php and adding the necessary javascript to target your specific inputs.
Call display: none css to your other error messages and keep only one common message
Write following code in your themes’s css file
span.wpcf7-not-valid-tip{
display:none;
}
You can try one plugin to set your custom error message.
Once plugin activated, there is another tab at each contact form which allow admin to set custom error messages just like you mentioned in question “Your name is required”, “Your email is required”.
Check the plugin’s snapshot or try a demo link at plugin URL itself.
Plugin URL: https://wordpress.org/plugins/cf7-custom-validation-message/