I have looked for hours now for proper documentation and forum posts on this(including https://contactform7.com/2015/03/28/custom-validation/#more-13626), and I am coming up empty. The following doesn’t work:
function spam_handling($result, $tag) {
// $spam = array('google', 'McDonalds');
// if($tag->name == 'Company'):
// if(in_array($_POST['Company'], $spam)):
$result->invalidate( $tag, "Spam" );
// endif;
// endif;
return $result;
}
add_filter("wpcf7_validate_text", "spam_handling", 5, 2);
What is the correct hook to use to validate text fields or specific fields in contact form 7? I am using the most up to date version. Also WordPress is updated.
]]>Hey,
I have translated the form and was hoping that I can map the values for dropdowns from the Language to to english?
Has this come up before. For example I have a drop down in french, when someone picks cars or “des voitures” I’m getting “des voitures” is there a way to map that to “cars” Like the <option value=”Cars”>Des Voitures</option>
]]>Hi i have installed CF& Custom validation plugin,but its not working with email field.please help..very urgent
URL : https://www.sreenellaihalwa.com/JNRS/contact/
Hello,
I’ve tried contacting you through your personal website’s homepage to request some (paid) custom work on your plugin. I’m not sure if you received my email. Could you please confirm?
Thank you
]]>This plugin is very useful however I found an issue when using it with the “Contact Form 7 – Phone mask field” plugin.
I’m using the first masked field named “mask-yob” for Year of Birth and the second masked field named “mask-zip” for Zip Code.
The fields Year of birth: [mask-yob] and User Zip Code: [mask-zip] work as expected in the mail form but the only message available in your plugin is the one “There is a field that the sender must fill in” which works a generic response for both fields.
The first masked field I used was for the zip code and the generic message field worked fine for that with the message “Zip Code Must Be Entered” now with Year of Birth added to the form having the same message for the Zip Code doesn’t work as well.
Is there a patch or additional code that might be added to allow for this issue?
Thank you for your time,
Greg
]]>Step 01
Go To “cf7-custom-validation.php”
Step 02
Find “`if ( ’email’ == $tag->basetype ) {”
Step 03
Add Following code
`if ( ’email’ == $tag->basetype ) {
$value = isset( $_POST[$name] )
? trim( wp_unslash( strtr( (string) $_POST[$name], “\n”, ” ” ) ) )
: ”;
if ( $tag->is_required() && ” == $value ) {
$result->invalidate( $tag, wpcf7_get_message( $name ) );
if ( ” != $value && ! wpcf7_is_email( $value ) ) {
$result->invalidate( $tag, wpcf7_get_message( $name ) );
}
}
}
]]>Custom validation error fields filled in, but still defaults to generic validation error – One or more fields have an error. Please check and try again.
NOTE*
The linked page is a test page that is not available from the root menu
Hi!
I’ve been using this plugin and it has been working fine until recently. I’ve updated WordPress and it still works and shows the custom message, however, for those fields with custom message, even though they’re filled in, CF7 assumes them as empty and won’t send the form.
I have to leave it disabled in order for the form to work (it’s a job application form for a company and it needs to stay working) but if you need to check it, please let me know and I’ll activate the plugin.
Thank you!
Regards,
Ricardo Carvalho
Hi Aiyaz and maheshpatel,
I have for example two required fields and one not required field:
Vorname*[text* vorname-lux]
Nachname*[text* nachname-lux]
Reisedauer [text reisedauer-lux]
1. All the required fields are not shown on “the error message custom”.
2 The not required field is shown on “the error message custom”.
Could you please fix this problem.
Thanks a lot.
Hello.
I developed a site recently with this plugin and ContactForms 7 4.7 and WP 4.9.1, and it worked perfectly. However, after updating to CF7 4.9.2, it doesn′t work anymore. Testing with some simple required text fields, although they contain values, when validating the form shows an error that the fields are required.
I’ve tested with CF 4.8 (in case the last version had something to do with it) and it still failed. Checking with CF 4.7, it works well.
To discard problems with other plugins, I installed a fresh WP with the default template, your plugin, and:
– CF 4.7 -> works good
– CF 4.8 -> same failure
I hope you could be so kind and provide an update to correct your plugin (which I have found quite useful).
Thanks in advance and regards.
]]>Hi, this plugin looks really nice, but has not been updated for more then 2 years. Before installing I would like to know if it’s safe and still maintained.
]]>Hello.
Thank you for plugin.
The plugin worked well until I tried to add the required file field. The plugin always displays an error message for the required file field, even if the file is selected.
How it is possible to fix it?
]]>hi,
this is not working for my website.
it did not add any of the custom messages in the message tab that you had given in the screen shot like “error messages for your name field”,”error messages for your email field” etc.,
and should i add these fields to message tab on my own?if it is how to?
this plugin is also not up to date with my wpversion.mine is 4.6.1. is that the reason why its not working?
please reply.
]]>I have installed and activate the plugin , but nothing happend .
sorry I really needed this plugin, but thank you for the effort!!
Hi,
I am not sure if this plugin is still being developed, but I really like the concept. Unfortunately it does not seem to work for the latest WP installation (haven’t tried earlier versions, though). The messages in the backend are not showing, which could be due to WP or CF7.
Any assistance would be appreciated ??
]]>