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.

Variables in HTML Blocks

  1. Is there any way to include dynamic content in an HTML block? I'm passing variables to my form, and although I can use them to pre-populate fields, I would like a way to display them in an HTML block. Using javascript doesn't seem to work.... I've tried:

    <p>
    The value of this variable is
    <script type="text/javascript">
    document.write(variable);
    </script>
    </p>

    Is there another method? In a nutshell, I just need to DISPLAY some data to the user. I don't want it in a form field, because I don't want them to be able to change the value. Any suggestions?

    Posted 11 years ago on Wednesday May 30, 2012 | Permalink
  2. David Peralty

    Try using this hook and just return true;
    http://www.gravityhelp.com/documentation/page/Gform_allowable_tags

    I am not sure that will let you do JS inside it though. You could put a div or whatever in there with a class and then put JS in your header.php file to manage the content of that div. (I'm not JS expert though)

    Posted 11 years ago on Thursday May 31, 2012 | Permalink
  3. @Capstone did you ever find a way to include dynamic content in an HTML block?

    I'm trying to do the same thing, but not seeing a way to do it... been searching the GF forums for an answer to this, but have not found any answer yet. :-)

    Thanks!

    Posted 11 years ago on Sunday June 17, 2012 | Permalink
  4. I was able to do this by creating a shortcode that retrieves the input values that I want to display in the HTML block. In this case I'm display only "product" values (i.e. for products that are set up using pricing fields - i.e. via PayPal / PayPal Pro add-ons).

    Here is the link to the code on PasteBin - http://pastebin.com/EQqYDMSC

    Posted 11 years ago on Monday August 13, 2012 | Permalink