0

Gravity forms offers a shortcode for conditional display based on responses.

[gravityforms action="conditional" merge_tag="{:3}" condition="less_than" value="30"] Your value is less than 30 [/gravityforms]

Is there a way to use TWO conditions in this shortcode? For example, I need to do greater than 10 and less than 30, like:

[gravityforms action="conditional" merge_tag="{:3}" condition="greater_than, less_than" value="10,30" ] Your value is greater than 10 and less than 30 [/gravityforms]

The above doesn't work, but wondering if anyone has found a way to do this?

1 Answer 1

1

You can nest the singular and plural versions of the shortcode:

[gravityforms action="conditional" merge_tag="{:3}" condition="greater_than" value="10"] [gravityform action="conditional" merge_tag="{:3}" condition="less_than" value="30"]Your value is greater than 10 less than 30[/gravityforms] [/gravityforms]

More details on that here:

https://gravitywiz.com/gravity-forms-conditional-shortcode/

- OR -

You can use this snippet to create multiple conditions in a single shortcode:

https://gist.github.com/spivurno/9db18385ed1d1f11a897bdfa8a1f2007

[gravityforms action="conditional" relation="and" value="{:3}" operator="greater_than" compare="10" value2="{:3}" operator2="less_than" compare2="30"] Your value is greater than 10 less than 30 [/gravityforms]

1
  • Thank you! The nested solution worked! I didn't realize I could nest them if I changed the plural. (However, need to remove the "s" on the end of the closing tag on the nested shortcode as pasted above). Note: The second snippet seems to no longer work with the latest version of GF.
    – LBF
    May 20, 2018 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.