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.

Populate dropdown with list field

  1. Hi all,

    I have a few questions:
    - is it possible to change one of the columns of a list field by a dropdown list?
    - is it possible to populate the different options in a drop down with one of the columns of a list field?

    What I would like to do is, in the first part of the form, a list of entries where the user can choose how many entries he would like to fill in. So the list field is perfect for this. But I'm wondering in I can make a drop down of one of the columns in this list. Then in a second part of the form I have a number of drop down fields of which the options should be populated dynamicaly to be all the entries of one of the columns of the list field in the first part of the form.

    if this possible?

    thanks in advnace for your help.

    Posted 12 years ago on Saturday February 4, 2012 | Permalink
  2. Richard Vav
    Administrator

    You can use the gform_column_input filter in your themes functions.php to convert one or more of a list fields columns to use dropdowns instead of text inputs. http://www.gravityhelp.com/documentation/page/Gform_column_input

    As for your second question I have to say I am not sure.

    Posted 12 years ago on Sunday February 5, 2012 | Permalink
  3. thanks richardvav,

    the Gform_column_input works. but the solution to the second question is more important for me. I had the impression I had seen a topic on that a few weeks ago, but now I can't find it.
    if anybody can find me an answer it would be much appriciated.

    I need to know if it is possible to populate a drop down with one of the columns of a list field.

    thanks in advance.

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  4. I already tested gform_pre_render to populate drop downs. but I can't find a way to get the entries in a list field, then I need to access all values in certain column, so I can put those in the items of a drop down?

    does anybody here have an Idea how I can get to the columns of list field from a form object? or any other way?

    thanks in advance

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  5. I'm confused by what you are trying to accomplish, it's not entirely clear to me what you are trying to do. You can dynamically populate a list field using hooks. But what you described is confusing so i'm not 100% sure what you are trying to do so if you can explain the workflow in more detail we cant hen determine what you need to do.

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  6. let me clarify that a little by explaining the flow of the form.
    I have a multi-page form, and in the first page I let the user fill in some locations with address, phone number, ... in a list field.
    on the second page I have a week schedule (5 days by 8 hours of drop downs). the aim is that these drop downs contain the location names from the first page so the user can select the schedule.
    so since the user needs to fill in the locations that he wants to schedule, I need a way to get all values in one column from the list field, say location name, and make them all the options in the drop downs on the second page.

    I hope this is a little bit more clear. I would like to know if this is possible or is there an alternative you can propose?

    thanks in advance for the response.

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  7. Okay, I understand now. This is a bit complex. There might be a way to do it but i'll need to get a developer to take a look and see the best way to handle this as it's not a simple dynamic population request given the moving pieces here. I'll have a developer take a look and see what would be the best way to handle this.

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  8. Hi Balansmedia,

    Here is a snippet you can paste in your theme's functions.php file. Be sure to update the $gf_vars to meet the specs of your form:

    http://pastie.org/3330873

    Posted 12 years ago on Monday February 6, 2012 | Permalink
  9. Thanks David,

    this solved my problem, it works perfectly for me.
    I'm wondering, I'm new to gravity forms but does the documentation that would allow me to learn these aspects of gravity form exist somewhere, or Am I obliged to dive into the code of GF to dicover these things?

    Thanks again for the help.

    Posted 12 years ago on Tuesday February 7, 2012 | Permalink
  10. finally here is what I'm using.
    I've adapted David's code a little to allow more drop downs, and add an empty choice.

    http://pastie.org/3333153

    Posted 12 years ago on Tuesday February 7, 2012 | Permalink
  11. does the documentation that would allow me to learn these aspects of gravity form exist somewhere, or Am I obliged to dive into the code of GF to dicover these things?

    We try to document most of the basic use case scenarios however, this is considered an advanced use case (and pretty niche as well). There is documentation about the various pieces used to put this code together, but it would require some understanding of Gravity Forms to code this from scratch.

    Sounds like you've got this all fixed up! Glad to hear it. I'm going to go ahead and close this topic but if you have any other questions please feel free to start a new thread.

    Posted 12 years ago on Tuesday February 7, 2012 | Permalink

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