Custom fields of type "Integer" with radio buttons can cause Advanced Search to break
Steps to replicate
- Create a new custom field (via the UI) of type Integer, HTML Type of radio buttons.
- Set "Is Searchable" to "yes" and save.
- Visit Advanced Search.
Expected result
Advanced Search worked identically to before the field was added.
Actual result
A JavaScript error:
Uncaught query function not defined for Select2 custom_9_from
The JS error will cause various parts of the form to stop working; the exact effect depends on the load order of the field in question. Select2 may stop working, accordions that load template snippets via AJAX may fail to open.
Technical Notes
The "Add Custom Field" form has a default for "Search by Range" set to "Yes", which is hidden by JS until someone sets "Is Searchable" to "Yes".
However, there's no widget to search by range on a multiple-choice field (it doesn't really make sense) so "Search by Range" remains hidden. Unfortunately, that means the field takes the default of "Yes". Advanced Search breaks because the widget doesn't exist.
This issue exists in master, but has existed at least as far back as 5.13.