Skip to content

Gravity Forms Reset Button

Chris Eggleston 2 min read

Symptoms

Gravity Forms does not have a built-in method for enabling any type of form reset button. This doc will show you how to add a Reset Form button or Clear Form button to any form built with Gravity Forms.

How To Fix It

There are two different approaches, use whichever one best fits your needs.

  1. Using the gform_submit_button filter
  2. Using one line of HTML in an HTML field

Known Limitations

1. The gform_submit_button filter does not work on all pages in multi-page forms (workaround here)
2. Neither solution will clear fields populated dynamically
3. Neither solution will clear a Product field that uses the Calculation field type

Using the Filter

With this option, you can target a specific form, or apply the Reset Button to all forms on your website.

The Reset button will be placed next to the submit button.

  1. Copy the code snippet below
  2. Paste the snippet into your themes functions.php file or a functionality plugin like WPCodeBox (recommended).
gf-reset-button.phpGist by chriseggGitHub
<?php

/**
*
* GravityRanger // Gravity Forms Reset Button
* https://gravityranger.com/gravity-forms-reset-button/
*
* Use this code snippet to add a reset button to your forms.
* Code snippet will add the button to all forms by default.
*
* Instructions:
*
*  1. Copy and paste the snippet into your themes functions.php file or use a functionality plugin like WPCodeBox
*  2. Add your form ID to the filter if you only want to add the button to one form (i.e gform_submit_button_ID)
*  3. Option: You can change the value (line31) to whatever you'd like (value="Button Text")
*
* Known Limitations:
*
*  1. It does not work on all pages in a multi-page forms
*  2. It will not clear fields populated dynamically
*  3. It will not clear a Product field that uses the Calculation field type
*
*
* @author    Chris Eggleston
* @link      https://gravityranger.com/
*
*/

add_filter( 'gform_submit_button', 'form_reset_button', 10, 2 );
function form_reset_button( $button, $form ) {
	$button .= '<input type="reset" value="Reset Form">';
	return $button;
}
  1. Modify the code as needed
    • Add your form ID to the filter if you want to only add the reset button to one form (i.e gform_submit_button_11)
    • Change the button text by modifying the value on line 31 (i.e value=”Button Text”)

Using an HTML Field

This solution isn’t ideal if you want to apply the reset button to all forms (use the filter for that), but this is a simple solution that can be implemented quickly if you just need to add it to one form.

The button is also placed within the form (wherever you put the HTML field) as opposed to next to the Submit Button.

  1. Add an HTML field to your form
  2. Copy the line of code below
  3. Paste it into the HTML field Content box
  4. Modify the value (button text) if desired
  5. Click Save Form
<input type="reset" value="Clear Form" />

Have a Multi-Page Form?

You can use the HTML method on a multi-page form, you would just need to add an HTML field to each page with the code above. You can change the button text to “Clear Page”, so that the user knows it will not reset the whole form.

Need More Help?

If you still need help, use the chat or leave a comment below and we’ll get back to you.

Comments

Ask a question or leave a comment

Your email is never shown. For help with a specific form, share what you expected and what happened instead.