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.

Adding current post title to hidden field on form that is on that post.

  1. I want to do something like this:

    http://www.gravityhelp.com/forums/topic/dynamically-populate-checkboxes?replies=2#post-19484

    But I need the form to *dynamically* fill a hidden checkbox with the name of the post/page/taxonomy etc the form is embedded in so i can pass it to newsletter integrator... So I can't use a case/switch statement as done in linked example.

    Much appreciated!

    Posted 12 years ago on Monday December 10, 2012 | Permalink
  2. You mention post/page/taxonomy. Do you need all 3 somehow, or is that just an example of the type of information you need? Can you be more specific?

    You can add a hidden field to your form and for the default value enter {embed_url} which will populate that field with the URL where the form is embedded. Do you need more or less information than that?

    Posted 12 years ago on Tuesday December 11, 2012 | Permalink
  3. Hello,

    The pages are fron a custom post type--Ideally I would love it to be in a form that would allow me to pass the name of an Aweber email list to subscribe to which could be based on the embed url's slug from your suggestion? But not sure that could be done dynamically.

    On another note, is there a way to embed a gravity form via HTML I frame instead of shortcode?

    Thank you!

    Posted 12 years ago on Tuesday December 11, 2012 | Permalink
  4. One issue at a time please. We will ignore your question about the iFrame for now.

    I'm sure what you are trying to do can be accomplished. If the Gravity Form is loaded in a page you need information from, you can use the gform_pre_render http://www.gravityhelp.com/documentation/page/Gform_pre_render filter to populate anything you like. You need access to the post global, then you can use any of the WordPress functions to access information about that post, including the slug, custom post type, template, etc.

    Can you give an example of exactly what you want to do? A link to the page, and what information you need from that page, and where you want to store it in your Gravity Form?

    Posted 12 years ago on Thursday December 13, 2012 | Permalink
  5. I was able to add page ID, URL, and title to a hidden field and pass this info to admin.
    Thanks!

    Posted 12 years ago on Friday December 14, 2012 | Permalink