Description
This filter is executed when the form is displayed and can be used to completely change the form button tag (i.e. <input type="submit">).
Usage
Applies to all forms
<?php
add_filter("gform_submit_button", "form_submit_button", 10, 2);
?>
Applies to a specific form. In this case, form Id 5
<?php
add_filter("gform_submit_button_5", "form_submit_button", 10, 2);
?>
Parameters
$button_input
- (string) The string containing the <input> tag to be filtered.
$form
- (Form Object) The current form.
Examples
This example changes the default input type to use the button element with an included span, popular for implementing the Sliding Door CSS technique.
<?php
// filter the Gravity Forms button type
add_filter("gform_submit_button", "form_submit_button", 10, 2);
function form_submit_button($button, $form){
return "<button class='button' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>";
}
?>
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in form_display.php