Populate dropdown in Section Editor

4 posts by 3 authors in: Forums > CMS Builder
Last Post: February 16, 2009   (RSS)

Re: [eduran582] Populate dropdown in Section Editor

By ross - February 16, 2009

Hi Eric

I think I know what you mean and there is actually a way with CMS Builder to get that going.

When you are in the Section Editor setting up a new field, there will be an option to have your drop down menu pull its values from a field in one of your other sections.

Just click modify for the list field, and look in the "List Options" area. The second option will be "Get Options From Database". Select that and you'll be able to say which table and which field from that table to use. For most situations, you can have the same field for value and label.

Give that a shot and let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Populate dropdown in Section Editor

Thanks, Ross; right there in front of me! A case of "can't see the forest for the tree's", I guess.

Works great for the 'second' step of what I'm trying to do. Is there a way to create a dropdown in the Section Editor that will show a list of all the tables and when the 'manager' selects a table the next dropdown will show the records of that table? I'm guessing I would have to use the 3rd option, "Get options from MYSQL query" to do that (or both) but I'm not sure how that would work.

Any suggestions?

Thanks again for opening my eyes [blush]

Eric

Re: [eduran582] Populate dropdown in Section Editor

By Dave - February 16, 2009

Hi Eric,

Yes, I *think* you could get it doing that. That first step would be to figure out the mysql query to list tablenames.

Keep in mind that if you allow your CMS users to submit MySQL values (such as the tablename) into a MySQL query you'll basically be giving them control to run arbitrary mySql queries. So you'll want to make sure your CMS users are trusted.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com