Choices icon indicating copy to clipboard operation
Choices copied to clipboard

Allow choices to decorate an invalid field

Open samuel-sol opened this issue 2 years ago • 2 comments

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

image 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

samuel-sol avatar Mar 11 '22 00:03 samuel-sol

Hey @samuel-sol,

Check out my solution over here,

https://github.com/Choices-js/Choices/issues/1022#issuecomment-1126575444

aaronjchristian avatar May 13 '22 23:05 aaronjchristian

@aaronjchristian Thanks, but don't work with release 10.

daikoz avatar Oct 20 '22 16:10 daikoz