Conditional Logic Object

Conditional Logic Object

IntroductionUsagePropertiesRule Properties

Introduction

Conditional Logic, when applied to the form or page button or to any field, controls the visibility of that element based on a choice selected or value entered by the user in other fields on the form. It can also be used to determine if a notification, confirmation or add-on feed should be used.

12345678910111213array(    'conditionalLogic' => array(        'actionType' => 'show',        'logicType'  => 'all',        'rules'      => array(            array(                'fieldId'  => 2,                'operator' => 'is',                'value'    => 'Second Choice',            ),        )    ),);

Usage

12345678// returns the conditional logic rules for the form button$rules = rgars( $form, 'button/conditionalLogic/rules' ); // returns the conditional logic rules for the field$rules = rgar( $field->conditionalLogic, 'rules' ); // returns the conditional logic rules for the feed$rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );

Properties

actionType stringThe type of action the conditional logic will perform. Possible values: show, hide

show: Displays the field when the rules match and hides the field when the rules do not match
hide: Hides the field when the rules match and displays the field when the rules match

logicType stringDetermines how to the rules should be evaluated. Possible values: any, all

any: Evaluates the conditional logic to true if any of the rules match. More specifically, will OR the rules together (i.e. rule1 || rule2 || rule3)
all: Evaluates the conditional logic to true if all rules match. More specifically, will AND the rules together (i.e. rule1 && rule2 && rule3)

rules arrayAn associative array containing the conditional logic rules. See below for the individual rule properties.

Rule Properties

fieldId integer
Target field Id. Field that will have it』s value compared with the value property to determine if this rule is a match

operator string
Operator to be used when evaluating this rule. Possible values: is, isnot, >, <, contains, starts_with, or ends_with is: Evaluates this rule to true when the value property is equal to the value of field specified by fieldId. isnot: Evaluates this rule to true when the value property is not equal to the value of field specified by fieldId. value stringThe value to compare with field specified by fieldId

Conditional Shortcode

Conditional Shortcode

IntroductionUsageExamplesShow content if a certain checkbox was checkedShow content if a certain field is not emptyShow content based on the price for a product field set to Radio Buttons type.

Introduction
The conditional shortcode allows you to perform conditional logic in the message content of your Admin and User Notification emails as well as the Confirmation Message that is displayed when a form is submitted.
The conditional shortcode consists of an opening and closing shortcode. Any text or content contained within the opening and closing conditional shortcode will be the content that is conditionally displayed.

Please note: Nested conditional shortcodes are not supported at this time.

Usage
[gravityforms action="conditional" merge_tag="{Number:1}" condition="greater_than" value="3"]
Content you would like to conditionally display.
[/gravityforms]

action
The action you would like to perform. This must be set to conditional as in the example above. (required)
merge_tag
The form merge tag who』s value you are executing the conditional logic for. You can get the correct merge tag for the form data you would like to use using the insert merge tag drop down. (required)
condition
The type of condition used to determine success. Available conditions are: is, isnot, greater_than, less_than, contains, starts_with, ends_with. (required)
value
The value that the condition must equal in order for the condition to be met and the content displayed. (required)

Examples
Show content if a certain checkbox was checked
In this case we use the :value modifier to ensure we』re checking the value (that can be different from the label). And we』re using the 「contains」 condition instead of 「is」 because the value for a checkboxes field can contain different choices separated by a comma.
[gravityforms action="conditional" merge_tag="{Checkboxes:1:value}" condition="contains" value="10"]
This content would be displayed if the value of field id 1 has a 10.
[/gravityforms]

Show content if a certain field is not empty
In this example, we want to show our content only if a Text field with id 5 is not empty.
[gravityforms action="conditional" merge_tag="{Text:5}" condition="isnot" value=""]
This content would be displayed if a value exists for field id 5.
[/gravityforms]

Show content based on the price for a product field set to Radio Buttons type.
In this example, we want to show our content only if the choice selected has a price of 3. Note the use of the :price merge tag modifier, and the lack of the currency symbol for the value.
[gravityforms action="conditional" merge_tag="{Radio Product:5:price}" condition="is" value="3"]
This content would be displayed if the choice selected has a price of 3.
[/gravityforms]

Configuring Authorize and Capture in PayPal Checkout

Configuring Authorize and Capture in PayPal Checkout

IntroductionConfigurationPayment Details for AuthorizationsRelated Notifications

Introduction
This feature of the official Gravity Forms PayPal Checkout Add-On allows PayPal to authorize the payment on a customer』s card at entry, but to not capture that payment (that is, collect the charge) until you choose, such as upon successful shipping of an order.
See this document from PayPal for more information.
Configuration
For your PayPal compatible form, choose Form → Settings → PayPal Checkout. Create new, or edit an existing feed.

Ensure Transaction Type is set to Products & Services.

Select the payment amount. This can be either a specific product field from your form, or the Form Total.

Enable the Authorize only option under Products & Services Settings and save your changes.

Payment Details for Authorizations
The entry detail screen for a payment entry will show a Payment Details section. When using authorization & capture, the entry will initially show a Status: Authorized along with transaction ID, amount, and a button that will allow you to Capture Payment.

Upon capturing the payment, the notes section is updated to indicate a successful capture and the Payment Details section updates to Status: Paid along with date, transaction ID, amount and a button allowing you to Refund Payment.
Related Notifications
Notifications can be configured to fire on the event of Authorization Voided. Refer to this PayPal document for more information on voiding an authorization.

Configuring Subscriptions in PayPal Checkout

Configuring Subscriptions in PayPal Checkout

IntroductionConfigurationSetup FeeTrialEntry DetailsNotifications

Introduction

PayPal Subscriptions allow you to create recurring payments according to a flexible schedule. Subscription support was added in version 2.0 of the official Gravity Forms PayPal Checkout Add-On (previously named 「PayPal Commerce Platform Add-On」).

Note: If you get a notice indicating that credit cards are not supported for subscriptions and will not display on the form itself, you will need to adjust the field settings. This field is not supported in all markets and accounts by PayPal. You can uncheck the Credit Card option under Supported Payment Methods in the PayPal Field settings to disable this notice.

Configuration

Before continuing, note that if your form uses AJAX submission, you need to turn it off. PayPal Checkout subscriptions are not compatible with AJAX submission.

For your PayPal compatible form, choose Form → Settings → PayPal Checkout. Create new, or edit an existing feed.

Change the Transaction Type to Subscription This will load the Subscription Settings options

Select the Recurring Amount. This can be either a specific product field from your form, or the Form Total to use the total of all pricing fields as the recurring amount.Subscription Product Type: Indicate the type of product that this subscription is for, either Digital, Physical or ServiceBilling Cycle: The billing cycle determines how often the recurring payment should occur. You can choose a numeric interval of days, weeks, months or years.Recurring Retry: Select this option to retry the charge again after a failed attempt.Recurring Times: Select how many times the recurring payment should be made. The default is to bill the customer until the subscription is canceled.

Setup Fee

You can either enable a Setup Fee or a Trial Fee. Click Enabled to enable and you can choose a product field from your form to be used as the setup fee.

Trial

Use the Trial to establish a trial period for your subscription. You can either enable a Setup Fee or a Trial Fee. Click Enabled to enable the Trial Fee and you』ll be given additional options to complete.1. Select a Trial Price: You can select either a Free Trial, enter an amount for the trial price or choose from the product field from your form as the trial price.1. Configure the Trial Period: This is the duration for the trial subscription until the regular price is charged. You can choose a numeric interval of days, weeks, months or years.

Entry Details

The entry detail screen will show Subscription Details box including status, start date, subscription ID, and recurring amount.

Notifications

You can set up notifications for the subscription related events of:

– Subscription payment completion– Subscription payment failure– Subscription cancellation– Subscription expiration

Each of these events can initiate a notification that you can configure normally.

Configure Quiz Settings

Configure Quiz Settings

IntroductionHow to access the Form specific Quiz SettingsQuiz SettingsGrading SettingsPass/Fail Grading OptionsLetter Grading Options

Introduction

When you add a Quiz Field to your form, a new section will automatically be added to the Form Settings that introduces Quiz specific settings that will affect all Quiz fields on your form.

How to access the Form specific Quiz Settings

From within your form, hover over Settings and click on Quiz. This will take you to a panel of Quiz related settings.

If you do not see the Quiz settings panel, double check that you have the Quiz Add-On properly installed and that you have at least one quiz field on the form in question.

Quiz Settings

SettingDerscriptionShuffle quiz fieldsRandomize the order of the quiz fields on this form each time the form is loaded.Instant FeedbackDisplay correct or incorrect indicator (✔︎ or ) and explanation (if any) immediately after answer selection. Once an answer has been selected it can』t be changed unless the form is reloaded. This setting only applies to radio button quiz fields and it is intended for training applications and trivial quizzes. It should not be considered a secure option for critical testing requirements.

Grading Settings

By default Grading is set to None, but if you would like to add the calculation of an overall grade to your quiz, you can select either Pass/Fail or Letter grading options.

Choosing a grading type will open up an additional set of options.

Pass/Fail Grading Options

Grading OptionsDescriptionPass PercentageIdentify the percentage score the user must equal or exceed to be considered to have 「passed.」Display Quiz ConfirmationPresent the user to either a pass or fail confirmation message upon submission of the quiz form. You can specify the exact text of either message in the applicable boxes using the rich text editor.Disable Auto-formattingWordPress will sometimes automatically add paragraph spacing to your text to help readability. If you』ve carefully crafted your layout (e.g. using HTML), select the Disable Auto Formatting checkbox to disable that function.

Letter Grading Options

This option lets you assign a letter grade based on the percentage score achieved. Click the + sign to add more letter grades, and set the letter identifier and the minimum percentage for each.

Display quiz confirmation and Disable Auto-formatting are described in the table above.

Configuring a Feed for the PayPal Checkout Add-On

Configuring a Feed for the PayPal Checkout Add-On

SummaryConfigure a feedFeed Settings ReferenceProducts and Services SettingsPayment AmountOther SettingsBilling InformationOptionsConditional Logic

Summary
The feed configuration determines what type of transaction should occur when the form is submitted, what to use as the payment amount, and which fields contain values that should be passed to PayPal.
If you have have added a PayPal Field to your form, you should find that a feed has already been created and configured automatically for you in the Form Settings > PayPal Checkout area. You』ll want to view this feed to ensure the Billing Information fields are mapped to the correct form fields.
Configure a feed

To configure a PayPal Checkout Feed do the following from your WordPress Admin Dashboard:

Click on Forms in the left side menu.
Select the form that you want to use with PayPal Checkout.
Once within your desired form, hover over Settings and click on PayPal Checkout.
Click Add New to create a new feed or click the Edit action link which appears when you hover over an existing feed in the table. You will then be presented with the PayPal Checkout feed settings screen.

Note: You can create multiple PayPal Checkout feeds for your form; however, you must configure conditional logic on them. The PayPal Checkout Add-On will only process one feed during submission; if conditional logic is not configured, it will use the first feed it finds.
Feed Settings Reference

The following fields are available within the settings screen.

A feed Name is required. It is only used for identification and will not be shown anywhere other than your feed listing.
Select the Transaction Type. This drop down contains the transaction types which the add-on supports. Products and Services or Subscriptions (recurring payments).

Products and Services Settings
If you select Products and Services from the Transaction Type drop down, the options below will appear.
Payment Amount

This drop down allows you to select what should be used as the payment amount. A specific product field within your form or the form total.
Other Settings
Under the Other Settings section, there are several other fields that can be configured.
Billing Information

Configures what billing information is sent to PayPal when processing a transaction. Map each of the billing fields to the desired form field that will contain that information.
Options

If you do not need PayPal to capture a shipping address, enable the checkbox labeled Do not prompt buyer to include a shipping address.
Conditional Logic

If unchecked, every successful form submission will be sent to PayPal. If you want payment to be conditional based on how the user completes the form, check the 「Enable Condition」 box and fill out the rules which must be met.

Configuring Confirmations

Configuring Confirmations

Editing or Creating a ConfirmationConfirmation Settings ReferenceConfirmation Type: TextConfirmation Type: PageConfirmation Type: RedirectChanging the Default Confirmation Message

Upon submitting a form in Gravity Forms, the user will be presented with a message or directed to a new page. By default, this is a simple message letting them know that the form has been successfully submitted and thanking them for their submission. In this article, we will show you how to change your confirmation message, as well as create custom confirmation messages based on the content that is submitted.

Editing or Creating a Confirmation

If you have not yet created a form, review our article on creating forms to get started. If you have a form ready, then access the form confirmations as follows:

Access your form by clicking on Forms from the left side navigation menu, and then clicking on the title of the form that you want to modify the confirmation message for.To access the confirmations for that form, hover over Settings on the top menu, and click on Confirmations.You will see a list of available confirmations. If you want to edit an existing confirmation, click on its title. To add a new confirmation, click the Add New button. Refer to the Confirmations List Page article for more information on available actions for this page.

Animation showing how to access the Confirmations settings page for a form.

Confirmation Settings Reference

When editing a Confirmation, the following settings are available:

SettingDescriptionConfirmation NameTo help identify the confirmation in the confirmation list. Name is not displayed to the user.Confirmation TypeOptions are Text, Page, and Redirect. Se below for more information on each. MessageThis is displayed to the user upon form submission.Conditional LogicConfigure more granular conditions that must be met in order to display this confirmation. The Default Confirmation doesn』t support conditional logic. For more information on conditional logic, see this article.

Confirmation Type: Text

Text confirmations allow you to display a bit of text to the user upon submission. If you need to thank the user for their submission, this is the best and most popular option for doing so.

There』s not much to configuring a standard text notification. Select the Text option, and begin writing your confirmation message in the box below. Use the Add Media button to add an image or video. If you want to disable the auto formatting of the text, enable the checkbox labeled Disable Auto-formatting.

Confirmation Type: Page

With the Page setting within the Confirmation Type options, you will be able to set a page within your site that the user will be sent to upon submitting the form. To configure your confirmation page, use the dropdown labeled Page to select the page you want the user to be delivered to.

With a custom confirmation page option, you may also have the form data sent to the page. For example, if you want the information on the page to change based on the form information submitted, under Pass Field Data via Query String add merge tags to the box. Example:

phone={Phone:1}&email={Email:2}

Confirmation Type: Redirect

If you want the user to be redirected to another location such as an external site upon submitting the form, you may set the Redirect option. To do so, select Redirect as the Confirmation Type, and enter the full URL that you want the user to be redirected to in the Redirect URL field.

Just like the page confirmation type, you can also pass the form information via a query string in the URL. Under Pass Field Data via Query String add merge tags. Next to this field is a Merge Tag Tool {..} to make adding merge tags easier.

Changing the Default Confirmation Message

To display a custom confirmation message, you will need to edit the Default Confirmation or create a new confirmation with conditional logic enabled. The Default Confirmation will be used if the logic fails on additional confirmations. The form needs to always process one confirmation, and therefore the Default Confirmation cannot be deleted, removed, or inactivated.

Therefore, if you want to use the same confirmation for all users submitting the form, customize the Default Confirmation. If you want to show a different confirmation based on conditional logic, add as many new confirmations as you may need and configure conditional logic for them.

For more advanced information on confirmation messages, take a look at our article on confirmation message conditional logic in which you will learn how to display different confirmation messages based on conditions specified about the form content.

Configuring Notifications in Gravity Forms

Configuring Notifications in Gravity Forms

What Is A Notification?Create a New NotificationEnter the Email SettingsMessage and SubjectDisable Auto-FormattingAdding An AttachmentUsing Conditional Logic With The Notification

What Is A Notification?

When a user submits a form, it can be quite helpful for the site administrator to receive a notification that a form has been successfully submitted. This ensures that you do not have to constantly check your Entries table to see if anything has been submitted. In this article, we will show you how to configure a basic notification for one of your forms.

Note that as your needs evolve, you can have multiple notifications for a single form, and even for a single submission. Additionally, you can determine which is activated on submission using complex conditional logic conditions. But for now, let』s just create a simple notification.

Create a New Notification

You will need to already have a form created. If you need to learn how to do so, you may review our article on creating forms.

First, access the form that you want to create a notification for. This is done by clicking on Forms on the left side navigation menu, then clicking on your desired form.At the top menu, hover over Form Settings and click on Notifications.You should now see a list of all notifications that exist for that form. By default, there should already be a single notification that sends the submissions to the admin email address within your WordPress installation. The list may be sorted alphabetically by clicking on the 「Name」 header. To add a new notification, click the Add New button.First, pick a name for your notification. This is simply something to easily identify the notification. Any unique name will be fine.

Enter the Email Settings

You will see a setting labeled Send To. This allows you to determine how the message is sent. The options available are the following: Enter Email: This is simply a single email address that all notifications for this form will be sent to.Select a Field: This option will allow you to send the notifications based on the contents of an email address field in the form.Configure Routing: This option will allow you to change the Send To email address used for the notification based on the options that the user selects in the form.For the purpose of this article, we are just going to take a look at the Enter Email option.When you have the Enter Email option selected, the Send to Email field will be available. Within this field, enter the email address that you want your form notifications to be sent to. You will need to configure a few different fields related to the email being sent. The first of these is the From Name field. When a notification email is sent, this is the name that will be displayed as the sender. Here, you can set this to something static, or dynamically generate that data. In this example, we want the name field from the form to be used as the From Name in the notification, click on the merge tag icon to the right of the field, and click on the field that you are using for the name. The number in the merge tag is the value of the field_id. Example: {text:4} will select field ID 4. {name:5.3} will target the 3rd subfield of the field ID 5. For more information on merge tags, refer to this article. Next up is the From Email field. This is the email address that is displayed as the sender when receiving the notification. You may set this to {admin_email} or use a static email address, but always use a valid from email to prevent sending and deliverability issues.There is also the Reply To field in which the reply address may be set. This can take a static email address, or use merge tags by clicking on the icon to the right of the field.The BCC field will allow you to set an email address in which the notification email will be copied to. This is useful if you have an individual that wants to receive all notification emails when sending to multiple people.

Message and Subject

The Subject and Message fields are the most important part of the notification. This is the content that lets you know the content of the form that was filled out. These default to a subject stating the form that was filled out, as well as the message containing the form content. Just like many of the previous fields, these also support merge tags to dynamically generate content. For most people, the default content is fine, but you may change this to anything you wish. Using the drop down icon next to the input boxes, you can select your form fields merge tags and also additional merge tags.

Disable Auto-Formatting

WordPress runs a function to help add paragraph spacing to your email text in order to help readability. If you』ve carefully crafted your notification layout (e.g. using HTML) and do not want any meddling from the system, select the Disable Auto Formatting checkbox below the message field.

Adding An Attachment

As of Gravity Forms 2.4, if there are File Upload fields on the form, the Attachments option displays. By selecting this option, the files that are uploaded on the form are included when the Notification is sent.

Using Conditional Logic With The Notification

Notifications support conditional logic, allowing you to define specific conditions that determine whether or not this notification gets sent. Select the option to enable conditional logic here, you can then configure your conditions. For more information on conditional logic, take a look at our article on configuring conditional logic.

Partial Entries Settings Reference

Partial Entries Settings Reference

Pre-RequisitesSettingsSave on ProgressWhen is a Partial Entry Saved?

The Partial Entries Add-On for Gravity Forms allows you to capture user input before the form is fully submitted. This can be quite helpful in identifying where users may be abandoning your form.

In this article, we will show you how to easily set up the capturing of partial entries on your form.

Pre-Requisites

Download and install the add-on.

Settings

Bring up the form you want to modify, and in the form editor select Settings → Partial Entries.

SettingDescriptionEnableTurn on the partial entries functionality for this form. Warning MessagePlaces an admin-defined message below the form description, making your users aware that their field values are being saved before submission.Enable Conditional LogicAllows you to set more granular conditions for when partial entry information is saved, based on completion of a specific field, or completion of a certain percentage of fields. See Save on Progress below.

Save on Progress

Partial Entries has two options under the Progress sub-heading: All Fields and Required Fields. You can set a percentage level against either of these criteria that will determine when the partial entry is saved.

In the image below, the partial entry will be saved once more than 40% of All Fields on the form have user input.

When is a Partial Entry Saved?

Partial Entries are saved depending on how often the site is ticking with the Heartbeat API, generally around every 30-60 seconds.Some hosts disable the heartbeat (like WP Engine) causing the Partial Entry to not save. Check with your site host on this.A partial entry is also saved when a page of the form is submitted (like a multipage form or a submission with a validation error) or the Save and Continue Later link is used.

Creating a Feed for the PayPal Payments Pro Add-On

Creating a Feed for the PayPal Payments Pro Add-On

SummaryCreate a FeedFeed Settings ScreenProducts and Services SettingsSubscription SettingsOther Settings

Summary
Before the PayPal Payments Pro Add-On can be used with Gravity Forms, you will first need to create a feed. A feed simply allows form submission data to be sent to another source. In this instance, payment data being sent to PayPal Payments Pro.
Create a Feed
To create a feed to PayPal Payments Pro using the PayPal Payments Pro Add-On for Gravity Forms, do the following from your WordPress Admin Dashboard:

Click on Forms in the left side menu.
Select the form that you want to use with PayPal Payments Pro.
Once within your desired form, hover over Settings and click on PayPal Payments Pro.
Click Add New to create a new feed. You will be presented with the PayPal Payments Pro feed settings screen.

Note: You can create multiple PayPal Payments Pro feeds for your form; however, you must configure conditional logic on them. The PayPal Payments Pro Add-On will only process one feed during submission; if conditional logic is not configured, it will use the first feed it finds.
Feed Settings Screen
The following fields are available within the settings screen. Refer to the settings screenshots below.

A feed Name is required. It is only used for identification and will not be shown anywhere other than your feed listing.
Select the Transaction Type. This will determine if you are selling a one-time or subscription-based product, and each has its own options to choose from.

Products and Services Settings
If you select Products and Services from the Transaction Type drop down, the options below will appear. If you have selected Subscription, you can skip this section as it will not apply.

Payment Amount: This drop down allows you to select the payment amount to either be a specific product field within your form or the form total.

Subscription Settings
If you select Subscription within the Transaction Type drop down, additional options that are specific to subscriptions will appear.

The Recurring Amount setting allows you to set the amount that the subscription will bill for. Using the dropdown, you can set the recurring payment amount as one of your product fields or the form total.
Pay Period determines how often the recurring payment will occur.
Recurring Times lets you set how many times the recurring payment will be made.
Enabling the Setup Fee option allows you to select a product field from your form to be used as the setup fee.

Other Settings
Under the Other Settings section, there are several other options that can be configured. These options are the same regardless of the transaction type you select.

Billing Information configures what billing information is sent to PayPal when processing a transaction. Map each of the billing fields to the desired form field that will contain that information.
Conditional Logic: If unchecked, every successful form submission will be sent to PayPal Payments Pro. If you wish to set specific conditions for sending form data to PayPal Payments Pro, then check the 「Enable Condition」 box and fill out your required criteria.
The API Settings option gives you the ability to override the default API credentials on a feed-specific basis. When doing this, the global API credentials will be ignored, and the ones within the feed will be used instead.
Click the Update Settings button to save your options.