Post

Gravity forms cheatsheet

No value set for skill_level_required

This article is compilation of some of the more intricate Gravity Forms Functions and Features.

Submit Partial information.

On a multipage form you can capture partial information. (first page of the form) using an elite gravity forms addon called. The Gravity Forms Partial Entries Add-On. This addon comes free for all elite license holders.

Disable duplicate submissions

Below are some methods you can use to prevent duplicate form entries though your gravity forms

Disable Ajax form submissions

no ajax

If you don’t know the cause of the duplicate entries. One of the first things to try is to disable the Ajax form submissions and just use a static thank you page confirmation. If Ajax is the cause then fixing this issue is outside the scope of this tutorial but at least you have narrowed it down.

Enable no duplicates

Gravity forms has a built in option in the form settings for no duplicates. The requirements for this powerful feature is a field within the form that takes a unique value. Like an invoice number which would be unique.

enable no duplicates on the gravity forms field

Create your own unique id hidden field

If you’re form doesn’t have a field that takes a unique value the you can just create your own.

  • Add the following snippet your functions.php file
  • Create a hidden field on your form
  • Update the form-id and field-id in the below snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_filter("gform_field_value_uuid", "get_unique");
function get_unique(){
    $prefix = "SLP2017-"; // update the prefix here
    do {
        $unique = mt_rand();
        $unique = substr($unique, 0, 8);
        $unique = $prefix . $unique;
    } while (!check_unique($unique));
    return $unique;
}
function check_unique($unique) {
    global $wpdb;
    $table = $wpdb->prefix . 'rg_lead_detail';
    $form_id = 3; // update to the form ID your unique id field belongs to
    $field_id = 7; // update to the field ID your unique id is being prepopulated in
    $result = $wpdb->get_var("SELECT value FROM $table WHERE form_id = '$form_id' AND field_number = '$field_id' AND value = '$unique'");
    if(empty($result))
        return true;
    return false;
}

Stop Gravity Forms Duplicate Submissions and Notifications generate unique id

Add a surcharge fee to a Gravity Forms transaction

One thing I love about gravity forms is You can use gravity forms for some basic e-commerce functions. It’s a great option if you just need to take a simple payment or have a simple product list and woocommerce would be overkill. But what if you needed to add a surcharge? Which is a common E-commerce function. If using woo we would probably just get a free plugin to do this for us. How can we do this with gravity forms E-commerce?

Add a 0.25% surcharge to the transaction

Add a surcharge to form with one product value

  • Add a product field and set it to be of the calculation field type.
  • Add the following code to the product calculation field
0.0025 * {Payment Amount:2}

Add Surcharge to a Form with Multiple Products Surcharge

  • Multiply all the product price fields by their respective quantity fields
  • Add them all together
  • Wrap that calculation in ();
  • Multiple by 0.0025
(
{fieldname (Price):1.2}*{fieldname (Quantity):1.3} +
{fieldname (Price):6.2}*{fieldname (Quantity):6.3} +
{fieldname (Price):8.2}*{fieldname (Quantity):8.3} +
{fieldname (Price):7.2}*{fieldname (Quantity):7.3} +
{fieldname (Price):9.2}*{fieldname (Quantity):9.3} +
{fieldname (Price):10.2}*{fieldname (Quantity):10.3}
)*0.0025
This post is licensed under CC BY 4.0 by the author.