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 a drop down with a field's unique entries from the past.

  1. tcauduro
    Member

    Here's what I'm trying to accomplish:

    Users are registering for an event, they can register as a Team or Individual.
    When registering on a team I need to be able to show a list of Teams already entered, or the option to create a new team if it's not in the list already.

    I've read the posts on how to dynamically populate a drop down field. I can populate by hardcoding the array.. so I've got that far. But how can I perform a query on entries for the form and grab distinct team names to populate this list with? Is there get_entries functions similar to retrieving posts functions?

    Another question, I currently have to use two fields to do this setup.. one for the drop down to select existing teams.. and a text field if a new team is to be added. Is there any way to have both of these form fields point to the same field when they're submitted? ie. one or the other, not both.

    Hope this makes sense.

    Posted 12 years ago on Tuesday February 7, 2012 | Permalink
  2. tcauduro
    Member

    I've solved the issue of having multiple inputs submitting to one field depending on some conditions I set. Used the gform_pre_submission hook.

    Still need to know how I can grab a list of unique values from a specific column of existing entries to dynamically populate a drop down in the gform_pre_render hook.

    Posted 12 years ago on Tuesday February 7, 2012 | Permalink
  3. Hi Tcauduro,

    Here is a function you can use to return an array of values for any field: http://pastie.org/3350601

    The returned array will look something like this: http://grab.by/bTkE

    Posted 12 years ago on Thursday February 9, 2012 | Permalink
  4. tcauduro
    Member

    Thank you very much!

    This helped me immensely! Exactly what I was looking for, works like a charm.

    Posted 12 years ago on Friday February 10, 2012 | Permalink
  5. Hi David,
    PLEASE a minute can save a SOUL! Kindly help me out with this post.
    http://www.gravityhelp.com/forums/topic/combine-two-functions-please-help
    thanks in advance

    Posted 12 years ago on Friday February 10, 2012 | Permalink
  6. Never mind david.
    You have killed the 2 stones(functions) with one bird here http://www.gravityhelp.com/forums/topic/dropdown-list-selected-value
    Only wish your support response time was faster.
    Thanks a bunch.

    Posted 12 years ago on Friday February 10, 2012 | Permalink
  7. Awesome! Glad we were able to help. :)

    Posted 12 years ago on Friday February 10, 2012 | Permalink

This topic has been resolved and has been closed to new replies.