fabianlindfors / multi.js

A user-friendly replacement for select boxes with the multiple attribute enabled
https://fabianlindfors.se/multijs
MIT License
953 stars 76 forks source link

Required Validation #48

Closed MinhInBlack closed 3 years ago

MinhInBlack commented 3 years ago

I noticed the plugin doesn't bring over "required" attributes or a functionality that validates if the field is required then no submission can be made. Is there a fix to this or is there an ability to do so already that I'm just not aware?

fabianlindfors commented 3 years ago

Hi!

Unfortunately, this is not possible. The required attribute only works on HTML form elements and hence can't be put on the multi.js wrapper. Putting it on the underlying select element is possible but it most likely won't work as multi.js will hide it using CSS.