Filter section editor by dropdown field label
5 posts by 3 authors in: Forums > CMS Builder
Last Post: December 20, 2022 (RSS)
By pgplast - August 22, 2022 - edited: August 22, 2022
I have an install of CMSB with a section editor called "Lecture for Symposium." One of the fields in this table is a list called, "Parent Symposium" that is derived from a MySQL call to the "symposia" table.
The user may filter a list of programs based upon a choice from the "parent_symposium" field. These values are the indices of the other table since it is called using: SELECT num,title FROM symposia
The symposium list is growing very long as programs are developed, and the site owner has asked if she might filter the list based upon the text in the labels of the dropdown rather than by the index value.
I made a quick attempt at this, (just to see if I might be lucky), by doing the following:
The original searching settings
Parent Symposium|parent_symposium|match
Title|title|query
The latered settings
Parent Symposium|parent_symposium|match
Parent Symposium Text|parent_symposium:label|query
Title|title|query
---------
This, of course, does not work.
Is there an existing workaround within cmsb for this, of must a plugin be written?
Thanks.
pgplast
By daniel - August 22, 2022
Hi pgplast,
When using a match search on a list field, it should by default create a dropdown where the user can select based on the label when filtering the list view. In this case, I would expect it to use the "title" field from symposia. Is this not what is happening? Or have I misunderstood and there is something else you're trying to do?
Thanks,
Technical Lead
interactivetools.com
By pgplast - August 22, 2022
Hi Daniel. I have not explained my question well enough.
I am aware that the menu shows the labels in the drop down. However, the filtering process is accomplshed on "match" and based upon the index num of the record.
My client wants to know if we can arrange for her to skip the scroll through a long list of such labels by creating another text field in which she can search by the text of the labels.
So, if there were a list that had index / values such as
1 | Functional endoscopic Sinus Surgery
2 | Transoral Microsurgery
3 | Laparoscopic Colectomy
she wants to have a separate searh field that allows her to put in a query with the text(label) of each option and still accomplish the filtering
e.g. if she put in "colectomy" she would get index 3.
By daniel - August 22, 2022
Hi pgplast,
Thanks for the additional detail - I understand now! Unfortunately, I don't think this is possible with the current section search functionality. I think this would be a good feature for us to add at some point, but currently, a custom plugin appears to be necessary. The simplest way I can think of is to have a plugin save the label text to a hidden field any time the record is updated, and set up the filter to search that hidden field instead. It duplicates some data, but would be pretty quick to create.
Let me know if you have any questions! Or if you'd like our help in setting this up, feel free to send us an estimate request: https://www.interactivetools.com/estimate/
Thanks,
Technical Lead
interactivetools.com