Gravity Forms has plenty of filters to customize your forms. We wrote very short articles in the past about filters we use a lot and decided to bring them all to this page for reference.
Capitalize fields in Gravity Forms
How to capitalize the content of a Gravity Forms input field? There are two possible angles. If you just want to display the content of a field in Uppercase, use the CSS. If you want to convert the user input to Uppercase while submitting the form, use the PHP solution.
Capitalize a form field with CSS for visual purpose
First you need the form ID and the field ID. Then add the following code to your CSS. Of course you need to change the Form and Field ID number. The correct CSS selector is ‘#input_FormID_FieldID’.
#input_6_1 { /*based on FormID and FieldID*/
text-transform: uppercase;
}
Capitalize a form field with PHP before entry
First you need the form ID and the field ID. Then add the following code to your functions.php. Of course you need to change the Form and Field ID number.
//Change _6 to the form ID number everywhere
add_action('gform_pre_submission_6', 'capitalize_fields_6');
function capitalize_fields_6($form){
// add all the field IDs you want to capitalize, to this array
$fields_to_cap = array('input_6_1');
foreach ($fields_to_cap as $each) {
// for each field, convert the submitted value to uppercase and assign back to the POST variable
// the rgpost function strips slashes
$_POST[$each] = strtoupper(rgpost($each));
}
// return the form, even though we did not modify it
return $form;
}
Change expiration date Save and continue Gravity Forms
Do you want to change the expiration date for Gravity Forms ‘Save and continue’ functionality (standard 30 days)? This is easily done by adding filter in the functions.php file in your theme folder.
How to change the expiration date in Gravity Forms Save and continue?
Just add the code below to the functions.php file in your theme folder. By changing the $expiration_days value you can set the number of days the form will be saved.
add_filter( 'gform_incomplete_submissions_expiration_days', 'gwp_days', 1, 10 );
function gwp_days( $expiration_days ) {
// change this value
$expiration_days = 365;
return $expiration_days;
}
Zip-code before City in Gravity Forms (order of address field)
Do you want to change the order of the Gravity Forms Address field items? Especially to put the ZIP-code before the City (as is usual in Germany and the Netherlands for example)? Here you find the easiest way.
How to change the ZIP-code field location in your Gravity Form
Copy this code in your functions.php in your theme directory and the zip-code will show before the City instead of after it.
add_filter( 'gform_address_display_format', 'address_format' );
function address_format( $format ) {
return 'zip_before_city';
}
Go to the top after Next or Submit Gravity Forms
When you use pages in your Gravity Forms (people click Next to go to the next page in the form) or when people submit their form, you may want to automatically have the page centred at the top of your website. This is very easy to do. It makes it much friendlier for visitors of your form, because they know that they start from the same point after clicking a button (Next or Submit).
How to create a top anchor in a multi page Gravity Form
Add the following code to your functions.php theme file. After people click Next or Submit, the page will be automatically outlined at the top of the page.
add_filter("gform_confirmation_anchor", create_function("","return 0;"));
WordPress Multi Site Gravity Forms License
If you use Gravity Forms in a Multi Site install of WordPress, and you create new sites,
you may want to add the Gravity Forms license key automatically to your new site.
How to automatically add Gravity Forms License key (and more) to multi-site installs
This is an easy way to prepopulate your Gravity Forms license key when new sites are created on a multi-site install. Add the following code to the wp-config.php file. More interesting multi-site automation options are described in de Gravity Forms documentation.
define("GF_LICENSE_KEY", "YOUR-LICENSE-KEY-HERE");
Our Premium add-ons for Gravity Forms
List Dropdown
Add a Dropdown Select with choices to a column or multiple columns in a Gravity Forms List Field.
List Datepicker
Add a Datepicker with calendar select to a column or multiple columns in a Gravity Forms List Field.
List Text
Add features like textarea, placeholder and custom validation to a column or multiple columns in a Gravity Forms List Field.
All Entries
All your new Gravity Forms entries in one central place. Stop navigating between multiple forms to find new entries. Get immediate oversight and full control with a powerful, unified dashboard.
Read tutorials about
Gravity Forms Airtable Integration: Create Records From Form Submissions
Learn how to build a Gravity Forms Airtable integration with GravityWP API Connector. Send form submissions to Airtable, create new records automatically, and save the returned Airtable Record ID and response back to Gravity Forms.
Gravity Forms Asana Integration: Create Tasks From Form Submissions
Learn how to connect Gravity Forms to Asana with GravityWP API Connector. This tested workflow creates Asana tasks from form submissions and saves the returned task ID and URL back to Gravity Forms.
Gravity Forms Google Calendar Integration: Create Events From Form Submissions
Connect Gravity Forms to Google Calendar with GravityWP API Connector. Learn how to create calendar events from form submissions, map event details, configure OAuth 2.0, handle time zones, and save the returned Event ID and URL.
Gravity Forms Notion Integration: Create Database Pages Without Zapier
Connect Gravity Forms to Notion without Zapier. This tested tutorial shows how to create Notion database pages from form submissions and save the returned page ID, URL, creation time, and API response.