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.

How to dynamically populate field with list of forms completed by a user?

  1. steltenp1
    Member

    I know this has to already be answered somewhere in the forum, but I haven't been able to find it. I'm a new GF user and would like to have two forms that sort of play off each other like this:

    Form 1 - Collects information like you'd see for a real estate listing ... The post title is the street address. It's in the Post Title field of a Custom Post Type called "properties" ... It's also in a category called "properties".

    Form 2 - I'd like to be able to use the second form to add more information from time to time that might relate to any property in Form 1 ... For instance, Form 2 might only need one date field plus a start and end time that could be used for an open house. This will be in a Custom Post Type called "events" and will also be assigned to an "events" category.

    I want to keep these things separate so an agent can create several different open house events and just associate the info with properties created using the first form. This way, they could use the same schedule for multiple properties or they could schedule several separate events for a single property. I can easily give others access to edit only event schedules this way. It also makes it easy for me to filter events a number of ways.

    To keep it simple for the agent, I'd like Form 2 (the event form) to have a dropdown list that is pre-populated with addresses of all properties created under the agent's login. (So, both posts would be created using the same login.)

    How do I pre-populate a dropdown on Form 2 with the Post Title from Form 1? The user id and login will be the same for both forms. If needed, I can add any number of hidden fields, etc.
    Thanks for any suggestions!

    Posted 13 years ago on Monday July 11, 2011 | Permalink
  2. You would have to do this by writing custom code to dynamically populate the drop down in Form 2 containing the list of properties. Here is a tutorial that discusses how to dynamically populate a drop down field using the available API hooks:

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

    Your custom code would have to query the entry data to get the data you want to populate the drop down with. So you'd have to look and see how to query the data and then use the tutorial above to write the custom code to populate the drop down.

    Posted 13 years ago on Monday July 11, 2011 | Permalink
  3. steltenp1
    Member

    Carl,

    Thanks for the reply and the link ... I feel like a total idiot, so please bear with me. I'm struggling less with the php portion than I am with what to do in the GF interface. Since your reply popped in 4 hours ago, I've read over the walk-through a dozen times ... I've read every other post on the subject that I can find. I am, thoroughly confused at this point.

    I think all I need to know is: Based on the walk-through you linked me to, which information goes where on the GF dropdown item? Am I to use a simple dropdown? Should it be, maybe the category dropdown (I think not) from the Post Fields?

    Again, sorry for being dense ... I'm amazed at the level of documentation you guys have ... I've just been struggling for a more basic understanding of which variable goes where ... AND the syntax to use. Punctuation of any sort?

    Again thanks for any help you can offer!

    Posted 13 years ago on Tuesday July 12, 2011 | Permalink
  4. Do you have any kind of budget for this? It might be something worth hiring a WordPress developer to handle for you. A developer with Gravity Forms customization experience could implement it much quicker for you and safe you the headaches if you aren't quite sure how dynamic population works. Let me know, I can refer you to some developers if so.

    Posted 13 years ago on Tuesday July 12, 2011 | Permalink