How to filter the content of a select box in the editor form?
How to filter the content of a select box in the editor form?

Hello,
I would like to know if there is a way to actually filter the content being loaded into a "select box" in the editor form.
Let's have a look at this example: https://editor.datatables.net/examples/simple/join.html.
The sites, db table has the "id" and "name" fields.
Question: Is it possible to only load the city names starting with "L" in the "Sites" select box? If yes, could you please tell me how to do it? My guess is adding a "where" clause on the "name" field, but for some reason I have only managed to filter the content of my table, not the content of the select box.
Thanks a lot and cheers for a great product!
This question has an accepted answers - jump to answer
Answers
Hi,
Yes indeed this is possible. The
Field->options()
method has an optional fourth parameter which is theWHERE
condition to be applied. Documentation for it is available here.Regards,
Allan
Thanks a lot! It worked like a charm.