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.

Multiple Pre-Populated in One

  1. David Peralty
    Administrator

    I'd love to add the US states and Canadian Provinces to the same list, but currently, there doesn't seem to be a way to easily do that.

    Posted 10 years ago on Wednesday October 21, 2009 | Permalink
  2. Dave,
    With a little bit of code, you can add your own predefined list with both U.S. States and Canadian Provinces. You can then easily select that predefined choice when creating fields.


    add_filter("gform_predefined_choices", "add_predefined_choice");
    function add_predefined_choice($choices){
    $choices["US/Canadian Regions"] = array("Virginia", "Augusta", "XXXX");
    return $choices;
    }

    Posted 10 years ago on Wednesday October 21, 2009 | Permalink
  3. Alex code snippet is for adding your own Predefined Choices. Is this what you are referring to David?

    Posted 10 years ago on Wednesday October 21, 2009 | Permalink
  4. David Peralty
    Administrator

    You have both as options, but I can't add both Canadian Provinces and US States to one drop down selection

    Posted 10 years ago on Wednesday October 21, 2009 | Permalink
  5. David,

    You can paste whatever you'd like into the bulk editor, just copy the provinces list and paste it in with the US states list... should work fine.

    Alberta
    British Columbia
    Manitoba
    New Brunswick
    Newfoundland & Labrador
    Northwest Territories
    Nova Scotia
    Nunavut
    Ontario
    Prince Edward Island
    Quebec
    Saskatchewan
    Yukon
    Alabama
    Alaska
    Arizona
    Arkansas
    California
    Colorado
    Connecticut
    Delaware
    Florida
    Georgia
    Hawaii
    Idaho
    Illinois
    Indiana
    Iowa
    Kansas
    Kentucky
    Louisiana
    Maine
    Maryland
    Massachusetts
    Michigan
    Minnesota
    Mississippi
    Missouri
    Montana
    Nebraska
    Nevada
    New Hampshire
    New Jersey
    New Mexico
    New York
    North Carolina
    North Dakota
    Ohio
    Oklahoma
    Oregon
    Pennsylvania
    Rhode Island
    South Carolina
    South Dakota
    Tennessee
    Texas
    Utah
    Vermont
    Virginia
    Washington
    West Virginia
    Wisconsin
    Wyoming
    
    Posted 10 years ago on Wednesday October 21, 2009 | Permalink
  6. Yea, like Kevin mentioned you can do some copy-n-paste and make your own list. The Pre-Defined options interface also lets you bulk add your own options by editing what is in the lefthand pane of the Bulk Add/Pre-Defined Choices interface.

    Posted 10 years ago on Wednesday October 21, 2009 | Permalink
  7. David Peralty
    Administrator

    Is there any special reason why I can't select multiple lists though? Just out of curiosity now...lol..

    Posted 10 years ago on Thursday October 22, 2009 | Permalink
  8. The pre-defined lists are just templates. You pick one, it populates the drop down. It wasn't setup to allow you to pick multiple pre-defined data types because typical usage isn't going to involve doing so. If you need to do anything unusual you can modify the data however you want using the bulk editor in the same interface.

    Posted 10 years ago on Thursday October 22, 2009 | Permalink
  9. deukdesign
    Member

    So I copy past a list of fields in the bulk add dialogue
    Can I then sort the bulk added fields?
    A-z z-a etcetera?

    It would be nice as well if we could save the list as custom
    so we can select at a later date again

    Posted 8 years ago on Monday March 21, 2011 | Permalink
  10. Gavin
    Member

    Hi, for the code snippet? What value will I need to put on the "Default Value"?

    Posted 8 years ago on Monday March 21, 2011 | Permalink
  11. @deukdesign You can create your own custom list that will always be available using the code snippet Alex provided above. That is used to create a custom bulkadd/predefined list of options that is available when using that feature.

    @Gavin I'm not sure what you mean by put on the "Default Value", can you elaborate?

    Posted 8 years ago on Monday March 21, 2011 | Permalink