WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Gravity Forms - Dynamically populate drop down menu... WITH CUSTOM FIELDS! (3 posts)

  1. Olly - OWMC
    Member
    Posted 9 months ago #

    Hi,

    Not getting the best of support from Gravity Forms. I have a dropdown menu in my form.

    I want to populate this drop down with text from a custom field in a custom post type. Using this code. I am able to populate the menu with the posts' titles. But how do I modify my code so that it displays the values from my custom field instead of the title?

    Gravity Forms support just told me I'm going to have to customise the code snippet. Instead of get_posts, I will need to use a WordPress function to get all my custom field names. But that's as far as the support has gone so far.

    I've used get_post_meta($post_id, 'custom_field_name', false) like so:

    http://pastebin.com/2fmqRb3T

    (I've replaced 'custom_field_name' with the actual field name obviously)

    But it just returns a drop down menu with blank choices repeated. There appear to be 8 blank choices which is the number of posts I'm calling within that category. So something is right, but I'm really not great with php. Can anyone tell me where I'm going wrong?

    Any advice, tutorials... anything, this has stunted me for days.

  2. Canned Ink
    Member
    Posted 3 months ago #

    I know it's been a while, but I'm wondering if you ever found a solution to this, or maybe even a tutorial or two for the dynamic dropdown population problem.

    I'm trying to write something that will allow for four drop-downs (year, make, model, trim level) so that you are only presented with the 'models' available based on your 'make' selection, etc etc.

    Any lucky finding any info on how to easily integrate this with Gravity Forms?

  3. esmi
    Forum Moderator
    Posted 3 months ago #

    If you require assistance then, as per the Forum Welcome, please post your own topic instead of tagging onto someone else's topic.

    I am now closing this 6 month old topic as it references an older version of WordPress.

Topic Closed

This topic has been closed to new replies.

About this Topic