Problem:
In a Custom Search in a View, using checkboxes, I want all selections to be removed each time a new option is selected, so the search allows only one selection.
Solution:
This is not possible in Toolset out of the box, as it is not how a filter is expected to work.
The common way to achieve a goal like yours is to uncheck/unselect previous sections.
This can also be done with Custom Code (JS), but we cannot provide Custom Code in this forum.
I think the easiest solution is to use a intelligent hint to the user of this search instructing what to do to receive certain results.
Another way is to add JS that unchecks everything when a new box is checked (as example if you use checkboxes for the search).
https://stackoverflow.com/questions/30556100/how-to-uncheck-all-checkboxes-if-one-checkbox-checked
Furthermore it is not the best solution, a Select Field would be better for this task as it allows already just one selection.
Cross field dependance is also not possible, hence, if you need to deselect other fields when a choice is made, custom code is needed as well.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
This topic contains 2 replies, has 2 voices.
Last updated by Suzanne Wenger 6 years, 5 months ago.
Assisted by: Beda.