Choices
Choices copied to clipboard
Allow choices to decorate an invalid field
Is your feature request related to a problem? Please describe.
I'm using Choices.js together with Symfony 5 and Bootstrap 5 to change some of my select to a pill selector. The issue is when you submit the form, and the user did not select any items, although the form won't be submited, there is no indication of error on the field. As in, it doesn't get decorated with the pseudo class :invalid
On the image above we have two required fields, on a normal select and another a Choices.JS pill selection. Both are required, I tried to submit and it failed as expected, BUT there is no indication on the choices field
Describe the solution you'd like
When a choices is validated to false, it should add a is-invalid
or another class to the outer div to indicate that the field is invalid. That way we can customize the class.
What are you doing meanwhile? I added an event to my form submit to add a class manually to the container div to do the decoration
Hey @samuel-sol,
Check out my solution over here,
https://github.com/Choices-js/Choices/issues/1022#issuecomment-1126575444
@aaronjchristian Thanks, but don't work with release 10.