Topic: make multiselect a required form field
nskalis free asked 4 years ago
If we consider the example Multiselect with options groups in https://mdbootstrap.com/docs/jquery/forms/multiselect/
In case of an
input field, the option
required works as expected. Displaying a tooltip ("Fill out this field") and not submitting the form.
In case of a
select field with the
multiple, the option
required has no effect and the form is submitted.
When adding the
required option and the user does not select any option, when clicking the
submit button, there should be a tooltip displayed like "Fill out this field" and not submit the form.
Resources (screenshots, code snippets etc.)
<select name="netelement_location" form="bgp_lookup" class="mdb-select md-form" multiple required>
Can you please advise how to solve this in case of multiselect ?
thanks, is it possible to display sth like this ?
(this appears if I remove the multi select and use the
it is not a tooltip, because it appears differently among browsers
I created a snippet with example code. Check out this link: https://mdbootstrap.com/snippets/jquery/mateusz-lubianka/1533756?action=forum_snippet
You can try to use validate option. Options for multiselect are the same like for select and you can find them here: https://mdbootstrap.com/docs/jquery/forms/select/#validation Try to use validate option and let me know, how it works.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.10.0
- Device: all
- Browser: all
- OS: all
- Provided sample code: Yes
- Provided link: Yes