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.

Using Hooks to Dynamically populate single line text

  1. Hi all.

    I have a question that needs answering. I've looked through the forums and documentation but haven't found exactly what it is I'm looking for.

    I'm trying to populate a "subject" field with the wordpress page title. In this case it's an address.

    I've tried several things including
    [gravityform id=3 name=Contact title=true description=true field_values='subject=$page_title']
    where $page_title is what I want to be populating the subject line in the contact form.

    So my question is, what do I need to replace $page_title with to get the actual title of the specific page a user is on? Ideally I don't want to have to create hundreds of contact forms for every specific page.

    Is this even possible?

    Thanks!

    Posted 12 years ago on Thursday August 18, 2011 | Permalink
  2. You can't use a variable in the shortcode. It's not going to get replaced. Values passed in the shortcode would have to be static.

    If you want to dynamically populate a field I would suggest using PHP. Here is a tutorial:

    http://www.gravityhelp.com/documentation/page/Using_Dynamic_Population

    Posted 12 years ago on Thursday August 18, 2011 | Permalink
  3. Thank you!

    I guess my question is now this: what would be my return value? $page_title?

    Posted 12 years ago on Thursday August 18, 2011 | Permalink
  4. If thats the name of your variable, yes. Or you can create a new variable, set it's value to the variable value you want and return that.

    Posted 12 years ago on Thursday August 18, 2011 | Permalink