Hi,
I need to validate some special characters (ñ) for Notifications and Forms.
How can I do it?
Thanks
Hi,
I need to validate some special characters (ñ) for Notifications and Forms.
How can I do it?
Thanks
You can create custom validation using the gform_validation filter. This is an advanced customization and in your case you would need to write a custom REGEX expression to validate what you want to do.
I can't write the customization for you as it is a customization but the gform_validation filter looks like this, keep in mind this example:
<?php
add_filter('gform_validation', 'custom_validation');
function custom_validation($validation_result){
// set the form validation to false
$validation_result["is_valid"] = false;
$form = $validation_result["form"];
// specify the first field to be invalid and provide custom validation message
$form["fields"][0]["failed_validation"] = true;
$form["fields"][0]["validation_message"] = "This field is invalid!";
// update the form in the validation result with the form object you modified
$validation_result["form"] = $form;
return $validation_result;
}
?>
If you need assistance writing this customization I can refer you to a WordPress consultant with Gravity Forms development experience who could work with you on this.
Hi Carl,
I need to change it for backend and frontend.
The function to add a filter is "is_valid_email" on common.php. Can I do that with a filter?
The Code:
http://www.pastie.org/1213458
Thanks.
PD: Sorry for my bad English.
What exactly are you trying to accomplish? There is no filter on the is_valid_email that I am aware of and i'm not sure why you would need to change backend notification functionality.
Hi Carl,
My email have an "ñ". If I don't change "is_valid_email" REGEX, "Notifications" -> "Send To Email" is not valid.
Is the only way change it on common.php?
Thanks.
Yes, if that is what you need to change the only way to change it would be to change the core plugin code in common.php as their is currently no hook for that. But we can look into adding a hook in the next release.
Hi Carl,
Would be a good idea create "add_filters" for that kind of data. And others to change the HTML.
Thanks for your help.