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.

Dynamically Populate Form-Field With Post Custom-Field

  1. We are building a website for a Tool Manufacturer with an elaborate 'request a quote' system. We need the Gravity Form's fields to be automatically populated by the custom-field values of the post wherein the Gravity Form is embedded.

    For example: John navigates to the list of tools (non-hierarchical custom post type) and chooses the tool he wants to receive a quote for. On the tools page the Gravity Form which is in place will have certain fields automatically populated with the custom-field values of that post.

    I already read: http://www.gravityhelp.com/forums/topic/can-pricing-field-populate-dynamically-from-custom-field but unfortunately this will not work.

    Ideally, I need to be able to place some PHP code (e.g. echo get_post_meta($post->ID, 'tool_measurement', true); ) within the 'Parameter Name' field under 'Allow field to be populated dynamically' section.

    Is this possible? Thanks in advance!

    Posted 12 years ago on Monday August 22, 2011 | Permalink
  2. Hi Elliot,

    Something like this ought to do the trick: http://pastie.org/2411990

    For more information on using the gform_field_value hook, read here.

    Posted 12 years ago on Monday August 22, 2011 | Permalink
  3. That looks very promising! I will try that out in a couple of weeks and let you know how it goes. Thank you!

    Posted 12 years ago on Friday October 14, 2011 | Permalink