PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

[if] statement in content template

  1. Is there way a way to have an "if" statement in the content template.
    For example i have an optional text field and want to display text only if its been filed in.
    Something like:

    [if {Text:1}]<p>some html here {another var:4} <span>{Text:1}]</span></p> [/endif]

    Posted 12 years ago on Tuesday December 20, 2011 | Permalink
  2. Conditional content templates are not a feature of Gravity Forms. However, you can do this by using the gform_after_submission hook and modifying the $post. It can't be done from the form builder. It's done with some code in your theme's functions.php.

    Here is an example of how I have done it in the past:
    http://pastebin.com/um5RWzGH

    Please ask questions about the code. Thanks

    Posted 12 years ago on Tuesday December 20, 2011 | Permalink