| CARVIEW |
Select Language
HTTP/2 301
date: Sun, 28 Dec 2025 00:22:29 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_next_button/
server: cloudflare
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
x-redirect-by: WordPress
fastcgi-cache: EXPIRED
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=SI39Sw8sKy8uwr33XblhA3GK51nT7txxWztERHXXZUNWr91WaE2S4%2FyTQmKy%2BmUD9cNPtoAsLRHMlk1e7%2BnQNMBz1r6m4GDG6J05PEbq1gv%2FPWv0"}]}
cf-ray: 9b4ce74f3df3860e-BLR
HTTP/2 200
date: Sun, 28 Dec 2025 00:22:30 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=Qvsh3NIcZCIoRKhCX74TlTCVu8B4WLfCEJC99LEb246h2Tmgd2bUqLwK0e4wyHuFLNs%2BAce3D9jwAf55ZcdJWlVXNkudazuqxpYZ%2BzVqcbrVY21S"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b4ce7525f25860e-BLR
gform_next_button - Gravity Forms Documentation
gform_next_button
Description
The “gform_next_button” filter allows the markup for the next button to be changed, giving the user control over how it looks.
Usage
Apply to all forms.
add_filter( 'gform_next_button', 'my_next_button_markup', 10, 2 );
Apply to a specific form.
add_filter( 'gform_next_button_10', 'my_next_button_markup', 10, 2 );
Parameters
- $next_button string
The default markup for the next button.
$form Form ObjectThe current form.
Examples
Change input to button
See gform_submit_button example 1.
Append a JavaScript action to the button
Adds an onclick action to the submit button.
add_filter( 'gform_next_button', 'add_onclick', 10, 2 );
function add_onclick( $button, $form ) {
$fragment = WP_HTML_Processor::create_fragment( $button );
$fragment->next_token();
$onclick = trim( (string) $fragment->get_attribute( 'onclick' ) );
if ( ! empty( $onclick ) && substr( $onclick, -1 ) !== ';' ) {
$onclick .= ';';
}
$onclick .= " addAdditionalAction('Additional Action');";
$fragment->set_attribute( 'onclick', $onclick );
return $fragment->get_updated_html();
}
Source Code
This filter is located in GFFormDisplay::get_field() form_display.php.
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?