How to Create a Global Dropdown List (list options)

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 16, 2009   (RSS)

By yodare - October 14, 2009

Seems simple, but I think I'm looking at it the wrong way. . .

Trying to narrow down the reasons for my admin drop-down list issues. Maybe someone could clearly explain how to accomplish the following:

CMSB v1.33
For Admin (add/edit) area use only:
1. Create one "global" or "master" list of drop-down options (like 100 options)
2. Use/Load the above data for list options when creating the corresponding List Field within Section Editors.
3. When the "master" list changes, all drop-down list options of that field will update.

I tried many different approaches, but could only produce <select> for drop-down options. Additionally, I was able to load an option drop-down list of section record titles. DON'T WANT TO CREATE 100 RECORDS containing only 1 field for each list option.

It would be nice if I could create 1 record with a text area field called Options_01 and load list options per line or array.

Any detailed explanation regarding the creation of "global" data/variables would be a tremendous help.

Thanks!

Re: [chris] How to Create a Global Dropdown List (list options)

By yodare - October 14, 2009

Hi Chris.

There are actually a couple reasons. . .

1. Don't really want to create 100 records and then cut/paste 100 times for each drop-down list item [crazy]. Unless I can batch records from text file array or CSV??
2. Would like to create some kind of template for "global" values. (ex: "Available Colors" list options for product A, B, and C would be different from products D, E, and F)

Lets say you have Possible Color Names based on each manufacturer. And you have a section to create records for products by each manufacturer. AND the Color Names change every year.

Is there any way to swap out last year's Color Names list with this year's Color Names list with a single copy/paste?

Thanks!

Re: [yodare] How to Create a Global Dropdown List (list options)

By Chris - October 15, 2009

Hi yodare,

1. Don't really want to create 100 records and then cut/paste 100 times for each drop-down list item Crazy. Unless I can batch records from text file array or CSV??


There are many ways to speed up inserting 100 records. phpMyAdmin has an Insert feature which lets you enter up to 40 records on a single page; I believe it also has a CSV import feature. Another approach would be to use CMS Builder's Database Backup feature and manually edit the SQL file to add your own rows, then Restore it (copy the backup file in case something goes wrong!)

Once you've got your records in your database, you won't need to copy and paste anything. You can set your List Field to "Get options from database (advanced)" and specify the section which has your options.

Is there any way to swap out last year's Color Names list with this year's Color Names list with a single copy/paste?


You can use any of the techniques above to DELETE and INSERT multiple records at a time. We could also build you a tool to do this through our Consulting service.

2. Would like to create some kind of template for "global" values. (ex: "Available Colors" list options for product A, B, and C would be different from products D, E, and F)


That's getting a little more complicated. Your Colour_List section could have a "category" (or "manufacturer") field and your Product section could have a "colour_list_category" (or "manufacturer") field. By using the "Get options from MySQL query (advanced)" feature, you can have the selection of one pulldown change the options available in another pulldown.

I hope this helps give you some ideas. If you have any trouble setting things up, please let me know.
All the best,
Chris

Re: [chris] How to Create a Global Dropdown List (list options)

By yodare - October 16, 2009

OK. . . Thanks for clearing that up. Sounds like I'll have to create a custom workaround. Just didn't want to "re-invent the wheel" if CMSB Admin area already had a simple way to import/input large global data lists.

Thanks Chris!