gform_previous_button

Description

Allows the markup for the previous button to be changed.

Usage

Apply to all forms.

add_filter( 'gform_previous_button', 'my_previous_button_markup', 10, 2 );

Apply to a specific form.

add_filter( 'gform_previous_button_10', 'my_previous_button_markup', 10, 2 );

Parameters

  • $previous_button string

    The default markup for the previous button.

  • $form Form Object

    The current form.

Examples

This example demonstrates how to use to this hook to wrap the previous button in an extra <div> with a custom class. Useful when applying advanced CSS styling to the Previous (or Next) buttons.

add_filter( 'gform_previous_button', 'my_previous_button_markup', 10, 2 );
function my_previous_button_markup( $previous_button, $form ) {

$previous_button = '
<div class="my-custom-class">' . $previous_button . '</div>
';

return $previous_button;
}

Source Code

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