- Issue created by @grumpy74
- Merge request !16Adding click event on coloris field element to force correct settings to take... → (Open) created by grumpy74
Using several form element "coloriswidget" in a custom form, with each fields having their own different settings (swatches, cancel button etc...), every Coloris instance the settings from the latest field.
Create a custom form using multiple "coloriswidget" fields with their own settings different, display the custom form and see that all coloris fields using the same settings as the latest field of the form.
I managed to make it work by adding, in the javascript file, an extra addEventListener 'onclick' on each coloris instance to recreate the coloris Object using the correct settings :
el.addEventListener('click', e => {
Coloris(settings);
});
Coloris(settings);
I think it is related to theat comment on Coloris library page : https://github.com/mdbassit/Coloris?tab=readme-ov-file#simulating-multip...
Apparently reacreating the instance on click on the textfield is taking in account the correct settings.
Check the proposed solution and test it in different usage contexts.
Active
1.0
Code