CARVIEW |
Select Language
HTTP/2 301
date: Sun, 12 Oct 2025 03:08:06 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
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
x-redirect-by: WordPress
fastcgi-cache: HIT
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=gndy98DFM6P%2FP3lUQOX1i5OlYtcAf%2FQphOeYVKu5WqQux9O7uu63w8whjhsKmlaZ83nFsKT6WbUMDHkgZ6FVHhwXjmMkCFl%2BQ7Sl%2BJdjPu6cvTw4"}]}
cf-ray: 98d36405ce8bcb77-BLR
HTTP/2 200
date: Sun, 12 Oct 2025 03:08:07 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
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: MISS
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=i2n2Rf1HKHwvFri%2BgUEgaM%2FcbkyVFeZ3QP5%2FrTjUJByg%2FM86wurHIj61R6uwxPzDbkkrYIOtL36tNW0jA%2BmI6Ow1cbOm78Zj3nuT7qZWIvBbFH1V"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 98d3640a7a72cb77-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?