Topic: How do I programmatically mark a Select as being valid / invalid
UNNdev priority asked 1 year ago
A regular input can be marked as valid or invalid by setting the
is-invalid class on the
form-outline after a server-side validation when generating the markup using Blade or Twig for example.
How can you set a
select as valid / invalid? The
div class="form-outline" is generated by MDB when creating a new instance and there doesn't seem to be a
data-mdb-* attribute I can set to hint the lib to automatically add
is-invalid to the generated wrapper.
data-mdb-validation works only with browser validation and only marks the input as being required.
Do I have to add the classes to the
select-input wrapper with JS after the component was initialized?
Dawid Wajszczuk staff answered 1 year ago
It is the best solution to add
is-invalid classes to the
select-input via JS after the Select initialization.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.9.0
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: Yes
- Provided link: No