Populate dropdown in Section Editor

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

Hi Dave,

Is there a way to populate a dropdown list that is added to a section with the values from another table?

I have several 'class names' sections, each containing several 'class' records, and a 'class dates' section. When the 'manager' is in the 'class dates' section, I'd like the 'manager' to have the ability to first select one of the tables from a dropdown (one of several) and then depending on what table is selected, populate another dropdown with the records from the table selected. This way there would not be any 'double-typing' which may cause a spelling error in the 'class dates' section 'title' which is used to compare titles when displaying the dates available. Make sense? I only see the ability for the admin to add selections now. [unsure]

TIA!

Eric

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: [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