Hi there,
I would like to create a drop down box with post ids and then store the selected post id with the form submission. Is this possible?
Hi there,
I would like to create a drop down box with post ids and then store the selected post id with the form submission. Is this possible?
Can you please provide me with more information on what you are planning to do? Post ID's are numbers. Do you want a list of Post Titles from your blog?
Hi David!
Thanks for checking in. Here is what I would like to do. I've created a custom content type called "Planters" and each "Planter" contains a bunch of information about the plant growing in that planter. I have created a gravity form "Plant Vitals" that records some basic data about the plant in the planter ie., moisture, light, pH.
What I would like, is a drop down list on the "Plant Vitals" form that lists all the available "plants" so I can attach a form entry to a particular plant.
Then, on each "plant" post, I'd like to query and grab all the "plant vitals" entries for a particular plant and display links to the individual form entries.
Does that give you enough to go on? Its still rough in my head, but ideally, I want my plant technician to open the form, select one of the plants, and record the data for that plant.
thanks so much!
What kind of coding ability do you currently have as doing this will require an intermediate level knowledge of PHP?
On the Gravity Forms side, you'll be needing to use gform_pre_render or gform_column_input to load the drop down with choices.
http://www.gravityhelp.com/documentation/page/Gform_pre_render
http://www.gravityhelp.com/documentation/page/Gform_column_input
On the other side, you'll need to create a wp_query to pull the posts of the type that you want and then push the titles into the drop down.
David,
Thank you!
I can handle php once I get a clear sense of what I need to do...having said that I've not been able to fully grok what you posted above...I know its a lot to ask, but is it possible to elaborate a little more? If not, no worries!
Thanks so much!
Here's what I would do step by step:
- In your theme's functions.php file add one of our two hooks that I linked to above. The second one is specifically focused on helping with drop downs. The first one is pre_rendering the entire form.
- Create a function that'll be related to that hook. Look at the examples in our documentation.
- Using WordPress' SQL query function, grab the posts you want from the database.
- Massage that data, grabbing the titles, and using the examples in our documentation and push it to the drop down.
Does that help at all?
Yes! :)) Thank you! I'll post back when I get some progress to speak of.
Have a great day.