Vue-multiselect: How to make the filed required?

Created on 2 Dec 2017  路  6Comments  路  Source: shentao/vue-multiselect

I didn't notice a way to make multiselect component required. It always allows me to submit empty multiselect where I don't select any options at all. I think it's better to include a prop that would control requiredness.

Most helpful comment

@shentao I recommend (very) to add props required in input.
Makes it easy with submit button and more semantics.

All 6 comments

I think it's better to control this with any-kind of form validation library... Additionally take a look at this example. Shows you how to do this validation that you want > https://vue-multiselect.js.org/#sub-custom-configuration

Thanks @PrimozRome!

@shentao when i add the required attribute to the input field in the html via chrome it works perfectly.

Can you somehow make it possible to add that attribute to the input field?

Here is screenshot.

@shentao I recommend (very) to add props required in input.
Makes it easy with submit button and more semantics.

Please consider reopening this/making this toggleable @shentao 馃檹

@adrianoresende except when the input is not searchable. And when it鈥檚 a multiselect where the value isn鈥檛 stored in the input. You need to use JavaScript to validate it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yaakovp picture yaakovp  路  3Comments

wujekbogdan picture wujekbogdan  路  4Comments

bushcode picture bushcode  路  3Comments

MaxHalford picture MaxHalford  路  4Comments

alexhyriavets picture alexhyriavets  路  3Comments