gform_form_validation_errors_markup

Description

The gform_form_validation_errors_markup filter enables the markup for the validation errors list, which is located at the top of the form, to be overridden.

Usage

add_filter( 'gform_form_validation_errors_markup', 'your_function_name', 10, 2 );

You can also specify this per form by adding the form id after the filter name.

add_filter( 'gform_form_validation_errors_markup_6', 'your_function_name', 10, 2 );

Parameters

  • $validation_errors_markup string

    The HTML for the validation errors list.

  • $form Form Object

    The current form object.

Examples

1. Basic usage

add_filter( 'gform_form_validation_errors_markup', function( $validation_errors_markup, $form ) {
    // Do something with the $validation_errors_markup.

    return $validation_errors_markup;
}, 10, 2 );

Placement

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GFFormDisplay::get_validation_errors_markup() in form_display.php.