Topic: Logins
Alexis Comte pro premium priority asked 2 years ago
Expected behavior
Invalid form should not be able to close dropdown
The classic bootstrap validation should be working
Actual behavior
I have created a dropdown with a FORM. Inside the dropdown form, there is a required field, when I try to validate the form with no value in the field, I get an error but the dropdown closes and the form diseappear. This should not happen while the form is not validated
also, I have tried the classic bootstrap validation and copied the code from
https://getbootstrap.com/docs/5.0/forms/validation/
but the code is not working, why ?
Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/alexis_comte/4765673
Test page available on https://www.affection.org/test/d.html
mlazaru staff answered 2 years ago
Hi,
you'll need to add data-mdb-auto-close="outside"
to the dropdown-toggle
button. Thanks to this option, clicking the button or any child of the .dropdown-menu
will not call Dropdown.hide()
method.
If you want to call this method manually after succesful validation of the form content, see this snippet:
https://mdbootstrap.com/snippets/standard/mlazaru/4767613#js-tab-view
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.0.1
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: Yes