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]

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注