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 dropdown via shortcode

  1. Anonymous
    Unregistered

    Is it possible to dynamically populate a dropdown with multiple key value pairs from the shortcode? The scenario I have is multiple State pages and for each state there are contacts. So for example, the NJ state page may have 2 contacts: 1) Lisa, lisa@gmail.com and 2) John, john@gmail.com. All of these state pages use the same exact form except where the email is sent to. So each page could have a shortcode calling the same form but passing a different array of values for the email dropdown.

    This is a bit more complicated so I don't expect shortcodes to handle this. I will probably have to use the pre_render filter and populate the dropdown like that. If I go that route, I would have to find an easy way for the user to add/edit/update values to populate the dropdown (label and value pairs).

    Posted 12 years ago on Wednesday February 15, 2012 | Permalink
  2. Just want to reply and say that I requested this but there was an issue with my account so it must have not linked to my new login.

    Posted 12 years ago on Thursday February 16, 2012 | Permalink
  3. It is not possible to dynamically populate a drop down this way. It's only possible to use the shortcode to pre-select an existing value. The shortcode does not support it.

    It can be done using custom PHP. What you could do is store the value of the 2 contacts as custom fields with the post that you create. Then you could write custom PHP to dynamically populate the drop down with those values when the form is displayed.

    You can find information on how to dynamically populate a drop down here:

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

    Posted 12 years ago on Wednesday February 22, 2012 | Permalink