choices.js instance Topic is solved

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
avinashpatwari
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Oct 18, 2021 2:24 pm

choices.js instance

Post by avinashpatwari » Mon Oct 18, 2021 2:29 pm

Hello!
I am implementing Joomla 4 custom component and in which i have form fields with layout="joomla.form.field.list-fancy-select" which uses library https://github.com/Choices-js/Choices

i have added one checkbox to select/deselect all options besides one of the field as Choices does not have select/deselect all feature.

https://github.com/Choices-js/Choices/issues/951
https://jsbin.com/taqiradeva/edit?js,output

As per that i need instance of fancy select which i am unable to get from library. can you please suggest me what options do we have to get specific instance of select box.

Thanks
You do not have the required permissions to view the files attached to this post.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2897
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: choices.js instance

Post by SharkyKZ » Mon Oct 18, 2021 7:11 pm

Choices instance can be accessed through the form field. Not sure if there's a better way, but this works:

Code: Select all

field = document.getElementById('jform_tags').closest('joomla-field-fancy-select');
select = field.choicesInstance;


Locked

Return to “Joomla! 4.x Coding”