Limiting options in a section editor pull down list field

6 posts by 2 authors in: Forums > CMS Builder
Last Post: April 22, 2011   (RSS)

By gkornbluth - April 20, 2011 - edited: April 20, 2011

Hi All,

I'm sure that the answer is somewhere in the forum, but I couldn't find it.

I’m stuck as to how, in a section editor pull down list field, I would limit the options available to only those that matched a checkbox value of “1" or “YES” in another table.

Here’s what I’m trying to do.

A client of mine wants to be able to offer custom made training videos for students of her dance school. Access to these videos will be restricted to members who have videos.

I’m using the membership plugin, and I thought if I could:

1) create “videos available” check box in the user accounts editor, and
2) create a video section with a pull down list that only showed those users who had their "videos available" check box checked,

I wouldn’t have to scroll through a long list to assign a new video to a specific member student.

I played with the get options from database and from a MySQL query but I’m totally lost on the latter.

Any specific suggestions?


Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Limiting options in a section editor pull down list field

By robin - April 21, 2011

Hey Jerry,

I think you'll need a MySQL query for the list field that looks something like this:
SELECT num, fullname
FROM `<?php echo $TABLE_PREFIX ?>accounts`
WHERE videos_available='1'

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Limiting options in a section editor pull down list field

By gkornbluth - April 21, 2011 - edited: April 21, 2011

Thanks Robin,

I'll give it a try.
Just one question.

Since I'm trying to limit the choices in the videos available editor, where do I insert the query?

The videos_available.ini.php?

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Limiting options in a section editor pull down list field

By robin - April 21, 2011

Hey Jerry,

That code should go in the list options box in the field editor after you choose "Get options from MySQL query (advanced).

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Limiting options in a section editor pull down list field

Robin.

Thanks.

Things are so easy when you know what you're doing.

Works like a charm,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php