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.

How can I customize the form's validation message text?

  1. Hi. I'd like to change the text of the form-wide error message that shows when the form fails validation.

    I found a bit of code here:
    http://www.gravityhelp.com/forums/topic/new-hooks-and-fliters#post-3254

    add_filter("form_validation_message",
    	   "change_message", 10, 2) ;
    function change_message($message, $form)
    {
      return "Failed." . $form["MyForm"] ;
    }

    This code snippet doesn't seem to change the message. This post is over a year old, so I'd like to know if it should still work. If so, what could I be doing wrong?

    Posted 12 years ago on Wednesday January 4, 2012 | Permalink
  2. I just tested this snippet below (placed it into my functions.php file) and it worked for me:

    add_filter("gform_validation_message", "change_message", 10, 2);
    function change_message($message, $form){
        return '<div class="validation_error"> Your Error message here </div>';
    }
    Posted 12 years ago on Wednesday January 4, 2012 | Permalink
  3. @sunil, unless it's a typo in what you posted here, you are using form_validation_message without the G in front. See Rob's code.

    Posted 12 years ago on Wednesday January 4, 2012 | Permalink