Problem
Multi-page forms are great for breaking long surveys or applications into digestible chunks, but they rely on a rigid assumption: the user must click through every page to reach the Submit button on the last.
That becomes a problem when the first few pages capture everything you actually need, and the rest is just bonus detail. You don’t want to force people to hammer the Next button five times just to finish.
Solutions
Gravity Forms doesn’t provide a “Submit from any page” switch in the UI, but with a small snippet, you can add a Submit button to every page.
Option 1: Code Snippet (Free)
This snippet adds a “Submit Now” button next to each “Next” button, allowing the user to submit from any page.
<?php
/**
* Gravity Forms: Submit from any page.
*
* Adds a "Submit Now" button next to each Next button, and skips
* required-field validation for pages the user has not reached.
*
* Replace 34 on line 15 with your fomrs ID number.
*
*/
add_action( 'gform_register_init_scripts', function( $form ) {
$form_id = (int) $form['id'];
// Optional: only run on one form.
// if ( $form_id !== 34 ) {
// return;
// }
$script = "( function() {
var formId = {$form_id};
var form = document.getElementById( 'gform_' + formId );
if ( ! form ) {
return;
}
form.querySelectorAll( '.gform_next_button' ).forEach( function( nextButton ) {
if ( nextButton.parentNode.querySelector( '.gw-submit-now' ) ) {
return;
}
var submitNow = document.createElement( 'button' );
submitNow.type = 'button';
submitNow.className = 'gform_button button gw-submit-now';
submitNow.setAttribute( 'data-submission-type', 'submit' );
submitNow.textContent = 'Submit Now';
submitNow.style.marginLeft = '10px';
submitNow.addEventListener( 'click', function() {
var target = document.getElementById( 'gform_target_page_number_' + formId );
if ( target ) {
target.value = '0';
}
if ( window.gform && gform.submission && typeof gform.submission.handleButtonClick === 'function' ) {
gform.submission.handleButtonClick( this );
} else {
jQuery( '#gform_' + formId ).trigger( 'submit', [ true ] );
}
} );
nextButton.after( submitNow );
} );
} )();";
GFFormDisplay::add_init_script( $form_id, 'submit_from_any_page', GFFormDisplay::ON_PAGE_RENDER, $script );
} );
add_filter( 'gform_field_validation', function( $result, $value, $form, $field ) {
$form_id = (int) $form['id'];
$source_page = GFFormDisplay::get_source_page( $form_id );
$target_page = (int) rgpost( "gform_target_page_number_{$form_id}" );
// Final submit from an earlier page: ignore fields on later pages.
if ( $target_page === 0 && (int) $field->pageNumber > $source_page ) {
$result['is_valid'] = true;
$result['message'] = '';
}
return $result;
}, 10, 4 );
What it does:
- Finds every Next button on the form and injects a Submit Now button after each one.
- Clicking Submit Now sets
gform_target_page_numberto0, which tells Gravity Forms this is a final submit rather than a Next-page request. - Submits through
gform.submission.handleButtonClick(), which is the current Gravity Forms 2.9+ submission path. Older versions fall back to jQuerytrigger('submit'). - On submit,
gform_field_validationskips fields on pages after the page the user submitted from, so required fields on unvisited pages do not block submission.
Limitations & Caveats
- Skipped pages are saved empty. Submit Now creates a completed entry, not a partial one. Fields on pages the user never reached will be blank. If you need abandoned/partial data, use the Partial Entries Add-On instead.
- Current-page validation still runs. Required fields on the page they submit from must still be filled in.
- Conditional logic. Fields hidden by conditional logic are not validated. That is core Gravity Forms behavior and is unchanged.
- AJAX forms. The snippet registers with
gform_register_init_scriptsso the button is added again after each page render, including AJAX page changes. - Gravity Forms version. Written for Gravity Forms 2.9+. Buttons are
<button>elements, and submission must go throughgform.submission.handleButtonClick(). The oldgf_get_input_id_by_html_idhelper is not used.
Option 2: Restructure with Conditional Logic (No Code)
If you don’t want to touch JavaScript, redesign the form so later pages are optional:
- Add a field on the first page (Radio Buttons or Drop Down): “Do you want to add extra details?” with choices Yes / No.
- On every later page, open the page’s settings and enable Conditional Logic.
- Set the condition: Show this page if “Do you want to add extra details?” is Yes.
- Make sure fields on those later pages are not required. Required fields on hidden pages will still block submission.
Now, a user who selects No sees the Submit button on page 1 because Gravity Forms hides the remaining pages entirely.
Need More Help?
If you still need help, feel free to use the comments or chat options below.
