Forum
Disable Chosen.js on categories output, leaving standard element
Hello,
I'm letting the Perch admin user chose from a set of Categories, like this:
<perch:categories id="language" label="Language" set="languages" />
<perch:category id="catTitle" />
</perch:categories>
In the admin area this automatically fires up Chosen.js and gives me a searchable list that you can select multiple options from.
Is it possible to disable Chosen and just output the categories in a standard <select> element? Or as radio buttons if all else fails, although that would take up a lot of space.
I only want the user to be allowed to select one category at once.
Thanks,
Gareth
PS I'm on Runway 2.8.29.
I'm just guessing here, but could you use display-as=”checkboxes” on the categories tag, which will get you halfway there - then add your own javascript to either update the selection process/form to radio buttons or use some validation to allow only one checkbox to be selected?
As I say, I'm only guessing!
Thanks Matt - that would work I think, but I'm reluctant to start adding JS to control the admin area (highly possible that future updates might break it!)
Hi Gareth,
You can add the javascript in a help section in the template I believe, meaning that future updates would be absolutely fine.
Or to keep Perch clean, look at UI customisations: https://docs.grabaperch.com/docs/customizing-perch/ui-customizations/
Bingo!
Matt
Ahha great, I'd never heard of that, I'll look into it :) Thanks.
Just to confirm - there's no option to disable Chosen otherwise.
Thanks - would like to request a feature if you have time in future that lets the user choose one option only. Turning off Chosen's "select multiple", or adding display-as="radio" in <perch:categories> maybe, don't know what'd be best.
Yes, that's logged already. Time is literally the only factor.
Ain't that the truth :)