PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Valid some Special Characters for Emails

  1. victor
    Member

    Hi,
    I need to validate some special characters (ñ) for Notifications and Forms.
    How can I do it?
    Thanks

    Posted 14 years ago on Sunday October 10, 2010 | Permalink
  2. 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.

    Posted 14 years ago on Monday October 11, 2010 | Permalink
  3. victor
    Member

    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.

    Posted 14 years ago on Monday October 11, 2010 | Permalink
  4. 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.

    Posted 14 years ago on Monday October 11, 2010 | Permalink
  5. victor
    Member

    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.

    Posted 14 years ago on Monday October 11, 2010 | Permalink
  6. 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.

    Posted 14 years ago on Monday October 11, 2010 | Permalink
  7. victor
    Member

    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.

    Posted 14 years ago on Tuesday October 12, 2010 | Permalink