0

I would like to populate a custom select field added to a channel, with a list of members that have a certain selection from a custom member field.

To generate the list of members currently in PHP, I get the id of the particular member field, then search the members list for a match on this field. And I have tried to inject this list to the custom select field via javascript, but on form post the validation fails with 'Invalid Selection', as the injected options are not accepted as valid against that field.

Is there a way to populate the custom select field with a list of members selected on a value of a custom member field?

0

There are a couple of fieldtypes on devot-ee that will let you run custom SQL queries and display the results as a dropdown for the user to select.

This is one: http://devot-ee.com/add-ons/query-field

Haven't tested it myself but something like that should solve your problem.

| improve this answer | |
0

The core function in EE that allows this is the Field Type add-on
http://ellislab.com/expressionengine/user-guide/development/fieldtypes.html

Bjorn's answer contains a nice add-on template for this, that allows a SQL query to be provided to populate the list.

This add-on is also a good example, it generates a list of members.

https://github.com/ckimrie/cki.member_list.ee_addon

For my question, I was able to modify the logic in this add-on to customise the list of members accordingly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.