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.

Dynamic Population into Drop Down Field

  1. Jeff
    Member

    I have a medical device website where we specialize in a discreet list of products. Each product has its own page and unique URL.

    I am designing a form to go at the bottom of each page that first asks if the interested person is a doctors office which if ticked, will display a set of form fields, or a consumer which would cause a different set of form fields.

    Each set of form fields with have at least 1 form field the same between them where they select the medical device or DME they are interested in. This field will be a drop down of choices including the discreet set of products we prefer to handle.

    I want to have this field default to the product for the page where the form is being displayed.

    Looking at the help information here:

    My plan to accomplish this would be to use the following in calling the form on any particular page:

    [gravityforms id=1 field_values='product_name=product_from_drop_down_list']

    where I manually insert the field value information.

    Will this set the default value to the product for the page the form rests on, provided I am careful to use the precise name in the drop down and "field_values"?

    Thanks!

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  2. Yes, that should work. Just keep in mind that what you pass needs to be the Value for that drop down field. So if you have enabled values when editing that drop down, you need to use the value and not the label.

    For example, here is my drop down choice settings:
    http://i.imgur.com/fkqnG.png

    I have configured this field to be populated dynamically:
    http://i.imgur.com/5cjao.png

    And here is the shortcode I used to set the drop down to the 3rd choice:
    [gravityform id=11 name=DynamicDropdown field_values='product_name=3']

    The 3 I am passing product_name is the value of the drop down I want to prepopulate it to.

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  3. Jeff
    Member

    Thanks Carl ...

    And if I wanted to "pre-select" one of several in a multi-select field, instead of "DynamicDropdown", what do I use?

    Jeff

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  4. What multi-select field are you referring to? Checkboxes? Because we don't currently have a Multi-Select Field. If so, you'd pass multiple values.

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  5. Jeff
    Member

    Sorry, wrong terminology, yes checkboxes. In your example above, I noticed the name="this_part" was related to the type of field, the drop down, so I was just wondering if I am doing something similar with Checkboxes, do I replace "DynamicDropdown" in your example with something related to Checkboxes?

    Jeff

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  6. You'd do it the same way you would a drop down. You'd edit the checkbox, allow it to be populated dynamically and give it a parameter name and then use that in the parameter name to populate that field dynamically. You'd pass multiple values by separating them with a comma.

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  7. Jeff
    Member

    I am sorry Carl, I did not make my question very clear.

    My question is, since this is for a Checkbox field, what do you replace "DynamicDropdown" with?

    I know I am over complicating this, very sorry about that.

    Jeff

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  8. "DynamicDropdown" in the name= field is the name of the form and has nothing to do with dynamic population. The name= attribute isn't even required, it's only there so you know which form it is because you may not know from the id itself.

    To pre-select checkboxes you would do the same thing you did to pre-select a drop down.

    For example:
    [gravityform id=11 name=DynamicDropdown field_values='my_checkbox=3,2,1']

    That would pre-populate the checkboxes with the value 3, 2, and 1 as being pre-selected.

    To pass multiple fields (your drop down and checkbox) you'd separate them with an ampersand.

    [gravityform id=11 name=DynamicDropdoxn field_value='my_checkbox=3,2,1&my_dropdown=3']

    Posted 10 years ago on Wednesday August 3, 2011 | Permalink
  9. Much thanks for the hints here! Between this and that dynamic population link, I was able to get a similar page up and running.

    Posted 10 years ago on Thursday December 1, 2011 | Permalink
  10. Glad that we were able to help you. Thanks for the update.

    Posted 10 years ago on Thursday December 1, 2011 | Permalink