Topic: How do I programmatically mark a Select as being valid / invalid
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?
It is the best solution to add
is-invalid classes to the
select-input via JS after the Select initialization.
Hire our experts to help you design or build a dedicated project.VIEW SERVICES
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.9.0
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No