How do I programmatically mark a Select as being valid / inv

Topic: How do I programmatically mark a Select as being valid / invalid

UNNdev pro premium asked a week ago

A regular input can be marked as valid or invalid by setting the is-valid or 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-valid or 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 3 days ago


It is the best solution to add is-valid, is-invalid classes to the select-input via JS after the Select initialization.

Keep coding,

Please insert min. 20 characters.


Specification of the issue
  • 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