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.

query string parameter at gform_pre_render

  1. run23
    Member

    I need to pass a query string parameter to the GF, which is I can do and retrieve via hidden field and dynamic population.

    However, this dynamic value is not available at gform_pre_render. I need this query string because it is a unique ID. This unique ID is used to populate DIFFERENT values dynamically into the form's fields.

    For example, lets say I invoke my form: http://www.foo.com/form/?ID=1 ID=1 means that this form pertains to the state of CA. Lets say I have a dropdown of zip codes that I want to dynamically populate with only CA zip codes.

    As I understand it, I must use the hook, gform_pre_render() to populate dropdowns. However, at this function, I don't see my ID field dynamically populated with the value, 1, so I can't determine what zip codes to fill in my ZIP dropdown.

    Any ideas?

    Posted 12 years ago on Monday July 23, 2012 | Permalink
  2. Where do the zip codes come from once you have the unique ID for the state?

    Posted 12 years ago on Monday July 23, 2012 | Permalink
  3. run23
    Member

    From a database. It's not the WP, but my own mysql db.

    Posted 12 years ago on Monday July 23, 2012 | Permalink
  4. David Peralty

    This function should be able to grab the query string to use as a look-up.

    You should be able to use:

    $stateid = $_GET["ID"];

    And then do your database look-up all within the pre_render hook.

    Posted 12 years ago on Monday July 23, 2012 | Permalink