50+ Gravity Form Hacks, Plugins, and Code Snippets
Gravity Forms is pretty much the de facto standard for form development inside of WordPress. The first thing that comes to mind is the standard “contact form” (which it’s very, very good at), but the Gravity Forms plugin can do so much more.
I have a developers license for GF, and it’s one of the first plugins I install in any website I build. I am always amazed by how much you can do with it, how many features are built in – and how easy it is to do a lot of things (that used to take much longer). Let me take you through what I’ve learned over the last few years using the plugin.
You can skip this part if you already have the plugin, but if you’re new – let me outline the reasons Gravity Forms is pretty much the de-facto forms standard within WordPress, and why using a free contact form plugin just really isn’t good enough anymore (if you build websites for clients or yourself):
- Entries saved in database: Most contact form plugins don’t store the entries in the db. If the email is lost, the entry is lost. To save entries in Contact Form 7, for example – you have to install an additional plugin. In Gravity Forms all entries are automatically saved in the database.
- Import and Export forms: You can easily import and export any or all forms from one website to another. With a third party plugin (later in this article), you can even export and import the entries as well
- CAPTCHA: The plugin has built-in support for the re-captcha service by Google. You can, however, use other captcha services using add-on plugins (see below)
- Support: This is a very mature, robust, and well supported plugin with a moderated community and staff
- Advanced fields and auto-population: Below, in the first section you’ll see that there are some advanced fields and auto-population or bulk add options that the free plugins just don’t have (or don’t do well).
Now, I’m going to take you through some features (you might not have known were there all along), some third party Gravity Forms plugins, and finally some PHP code snippets and hacks.
Gravity Forms Built in Features
Here are some features of Gravity Forms you may not have known existed (if you haven’t used them). You might have already come across them, but I seemed to find them one by one over time (as I needed the features).
Adding straight HTML to Forms
This is much easier than you think. Just add the Standard Field “HTML”, and you can then add HTML into your form like this:
Conditional Form Fields
Let’s say you want to make a fields “conditional”. You ask a question and if they say “yes” you show an additional question, but if they say “no” you don’t.
Just edit the form field you want to be conditional – and then click the “advanced” tab. Check the “Enable Conditional Logic” checkbox, and choose the question that makes this fields conditional – and what the value should be to make it appear like this:
Conditional Form Recipients
You can even have “conditional recipients” for a gravity form. Like the image below, send email to one person, or department if a certain conditional is met, and others for other conditions. This is great if you have a form with choices for “sales”, “service”, “support”, etc.
Creating Columns in a Form
You may not know this, but it’s very easy to create columns for multiple input fields in the same section of a Gravity Form. For instance, let’s say you have 20 check-boxes, but it’s just one big vertical section. Wouldn’t that look better as 2 or 3 columns? What if you have city, state, and zip code – and what those all on the same line? Just refer to the Gravity Forms CSS Ready Classes page.
Then, add the class you want in the Advanced tab of a GF form field under “CSS Class Name” – as in this image:
If you don’t want to have refer to that page every time to figure out which CSS class to use, just install theGravity Forms CSS Ready Class Selector plugin. It adds a button to the right of the CSS class name field – to add what you need – like this:
You get a really cool popup which makes it very easy to add the CSS class you want:
Gravity Forms Third Party Plugins
You might already have a few of these Gravity Forms add-on plugins installed, but I guarantee that you don’t have them all (and probably didn’t know half of them existed). You’ll get some great new ideas once you browse through these!
Plugins that Add Features to Gravity Forms Itself
Gravity Forms Toolbar: this is one of the coolest plugins I’ve seen in awhile. It adds some content to your admin toolbar that takes you right to “entries”, or “add new form”, but it also adds links on the backend that lead right to forums, support, help-docs, etc.
Here’s a peek at the backend time-saving links:
Gravity Forms Terms of Service Field: Plugin does just what it says, adds a terms of service fields to your form. Doesn’t allow people to submit unless they click the terms of service (first). If you’ve ever had to code this by hand (like me) – you know how much time this plugin saves.
Gravity Forms – Placeholders: adds HTML placeholder support for GF form fields – and you get JS fallback.
Gravity Forms Popup Widget: rather than embed your Gravity form into the content of the page or a widget, have you ever wanted it to be in a popup or modal window? This plugin takes care of that, and even allows for an intro page before the form is shown – perfect!
Form Lightbox: is a plugin that allows you to put a gravity form inside a popup lightbox (so it doesn’t have to be embedded in the page content).
Gravity Forms PDF: ever thought it was a pain to view your Gravity Form entries, or thought downloading them to Excel was a pain? With this plugin you can just export them to a nice little PDF file. This plugin is the original.
Gravity Forms PDF Extended is a fork of that plugin – which claims to have better rendering capability. It can do a bit more too, like created a PDF of a form submission (that you can use in a notification), and it has the ability to create PDF template. You can view and download the PDF files in admin, and you can even output the PDF to a template or plugin.
Gravity Forms Data Persistence Add-On: by default is a visitor abandons a gravity form – when they come back they have to fill it out all over again. With this add-on for GF installed, they will be able to pick up again where they left off (if you have multi-page or multi-step forms).
Gravity Forms – Clockwork SMS: is an add-on that sends out SMS text message notifictions when a form is submitted, using the Clockwork API.
Gravity Forms CustomCaptcha: gives you an alternative to reCaptcha – uses the Securimage PHP Captcha system instead.
Are You a Human Free Captcha Alternative: is another captcha alternative (to reCaptcha) add-on for Gravity Forms.
SpamCaptcher: is a captcha alternative as well, it uses a TrustMe account.
WP Email Template: works with Gravity Forms, as well as anything that sends email from your website. GF already has an email template, but using this plugin you can make all outgoing emails from any plugin or WordPress itself – have the exact same template.
Pronamic Events is a plugin that allows you to add events capability to your WP website, but it works with both Gravity Forms and Gravity Forms + Custom Post Types.
infoGeniuz Advanced Form Analytics for Gravity Forms: adds some additional stats to your gravity forms, such as geo-location, number of visits and page-view, and browser data.
Gravity Forms RSS: is an add-on that allows you to read form entries as an RSS feed. Yes, it’s secure – the RSS feed isn’t public (without the token).
Misamee Gravity Forms Tools is a plugin that adds a few additional features to your Gravity Forms. Such as the ability to total fields entered (and provide sum), or a progress bar, to show how much of the form is filled out.
Gravity Meta is a unique plugin that allows you to add some custom URL parameters to gravity forms as hidden custom fields. This way you can add some tracking to your forms (with an alternative to custom JavaSript).
Gravity Forms Dropbox Uploader: if you have a Gravity Form that has an attachment field – this add-on plugin offloads the attachments to a Dropbox account (awesome!).
Gravity Forms Importers
Where there’s another plugin with data, there’s a way to import that data into your GF installation.
Contact Form 7 Gravity Forms Importer: converting Contact 7 forms into Gravity Forms couldn’t be easier.
Gravity Forms API or Service Based Plugins
There are a lot of third party and add-on plugins for Gravity Forms that allow you connect with and / or submit form data to an external service (usually through an API).
Gravity Forms YMLP add-on: is an add-on for the YMLP (Your Mailing List Provider) mailing list service.
Gravity Forms Constant Contact Add-on: submits gravity form content to Constant Contact.
Gravity Forms ExactTarget Add-on: submits content to the Exact Target email marketing service.
Gravity Forms Mad Mimi: Submits gravity forms content to Mad Mimi email marketing service.
Gravity Forms ShootQ add-on: connects a gravity form to the ShootQ service (for photographers), that manages prints and photos.
Gravity Forms Subscriptions allows you to switch between one-time payments or subscriptions if you’re using Gravity Forms for payments.
Gravity Forms Stripe Add-On: allows you to accept payments using Stripe through a Gravity Form.
Gravity Forms Infusionsoft is an add-on that allows you to submit to your Infusionsoft CRM account from a gravity form.
Gravity Forms iContact Add-On: allows you to send Gravity Forms submissions to iContact (email marketing service).
Gravity Forms HubSpot Add-On: submits gravity forms data to the HubSpot lead API for inclusion in your account
Gravity Forms Fat Zebra: is an add-on that allows you to take payments (through a gravity form) using the Fat Zebra payment gateway (Australian).
Gravity Forms Sugar Event Calendar: an add-on that gives you integration with your Sugar Event Calendar (even registration service).
Gravity Forms eWAY submission: earlier this year I heard of eWAY for the first time, which is an online payment solution. It’s a very popular credit card payment gateway, and a LOT of non-profits and organizations use it for donations and payments. Now accepting those payments is as simple as created a gravity form.
Gravity to Solve360: allows you to export data from Gravity Forms to a Solve360 account (could based CRM solution).
Gravity Forms CapsuleCRM Add-On allows you to populate your CapsuleCRM account with gravity forms submissions.
Gravity Forms Submitting Content to WordPress (Posts, Plugins, or Themes)
Gravity Forms + Custom Post Types: nice add-on plugin for GF that allows you to take a form submission and create a post inside WordPress and map it as a custom post type. Supports taxonomies, and has a nice UI.
Gravity Forms WYSIWYG is a plugin that allows you to put an advanced (TinyMCE) editor in place of an input field. I put this add-on plugin in the submitting content to WordPress section, because you would most likely want this kind of formatting and layout ability for using a GF to submit content to WordPress (or somewhere that needed HTML, etc.)
OptionTree Extension: Gravity Forms is a plugin that allows you to select a Gravity From from within OptionTree settings. OptionTree is used by a lot of premium theme authors for WP theme admin.
Headway Leaf: Gravity Forms Leaf is a plugin that allows you to use a Gravity Form within a Headway leaf (in the content, sidebar, etc.). Headway is a very popular drag and drop theme building framework.
Gravity Forms – Update Post: allows you to update or delete posts, pages, or custom post types using a Gravity Form. It does repect user capabilities – there’s a lot of things you could do with this.
Gravity Forms Hacks and Code Snippets
I tend to collect as many GF snippets of code as I can, and I frequent Gravity Wiz quite a bit as well. Here’s snippets I use from that site frequently:
Shortcode to display number of entries left: some code to display on a page how many entries are left (if you’ve set a limit).
Random Fields with Gravity Forms: allows you to randomize the fields shown on a Gravity Form.
Limiting How Many Checkboxes can be Checked: does just what it says (in a GF form).
Limit IP to One Submission per Time Period: same thing – handy if you’re running a contest or form that people shouldn’t be filling out multiple times.
Here are some of the best Gravity Forms code snippets I’ve found in other places (and use a lot):
Edit User Profile with Gravity Form: this works well – and gives you screenshots as well as complete code for setting up the actions and functions.
Gravity Forms Code Collection: great deal of posts tagged “gravity forms” with code for adding a button class, adding a class to the GF submit button, form validation hook, using a gravity form outside of WordPress, changing the upload path, attaching files, custom field filters, taxonomy fix, and more.
Gravity Forms Snippet: hide fields: this is a great snippet for hiding specific fields from logged in and / or logged out users.
Insert Gravity Form Data into New Table: awesome snippet that takes gravity forms data and submits it to another MySQL db table using an action.
Trigger jQuery when Gravity Forms input button is clicked: helpful piece of code, if you’ve ever had to do this and not had success.
I hope you find this as a helpful resource. Be sure to bookmark this page for future reference. As always please post any comments below.
Link: Gravity Forms