You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title:required Validation Not Working When searchable is Set to false
Description
I encountered an issue where the required validation does not work when the searchable prop is set to false. By default, searchable is true, and the required validation works as expected. However, when I explicitly set searchable: false, the component allows form submission even when no option is selected.
Steps to Reproduce
Use the <Multiselect> component with :searchable="false" and required inside a form.
Do not select any option and try submitting the form.
The form submits successfully, even though it should prevent submission due to the required field.
Expected Behavior
The required validation should work regardless of whether searchable is true or false. If no option is selected, the form should not be submitted.
Actual Behavior
When searchable is false, the required validation is ignored, and the form submits without any errors.
Reproducible Example (if applicable)
<template>
<form@submit.prevent="submitForm">
<multiselectv-model="selected":options="['Option 1', 'Option 2']":searchable="false"requiredplaceholder="Select an option"
/>
<buttontype="submit">Submit</button>
</form>
</template>
<script>
importMultiselectfrom"vue-multiselect";exportdefault { components: { Multiselect },data() {return { selected:null, }; }, methods: {submitForm() {alert("Form submitted! This message should display only if option is selected"); }, },};
</script>
Environment
Vue: 3.5.13
vue-multiselect: 3.2
Browser: Chrome v134
The text was updated successfully, but these errors were encountered:
Title:
required
Validation Not Working Whensearchable
is Set tofalse
Description
I encountered an issue where the
required
validation does not work when thesearchable
prop is set tofalse
. By default,searchable
istrue
, and the required validation works as expected. However, when I explicitly setsearchable: false
, the component allows form submission even when no option is selected.Steps to Reproduce
<Multiselect>
component with:searchable="false"
andrequired
inside a form.Expected Behavior
The
required
validation should work regardless of whethersearchable
istrue
orfalse
. If no option is selected, the form should not be submitted.Actual Behavior
When
searchable
isfalse
, therequired
validation is ignored, and the form submits without any errors.Reproducible Example (if applicable)
Environment
The text was updated successfully, but these errors were encountered: