Topic: Stepper validation not working with SELECT elements

softcon premium asked 2 years ago


Expected behavior

When applying "required" to a SELECT element. SELECT elements with a value of nothing (where default OPTION value="") should be seen as invalid, as is the case with standard HTML5 form validation. The stepper should flag this item as invalid (required), and not move to the next step.

Actual behavior

Stepper validation allows SELECT elements with a value of nothing (where OPTION value="").

Resources (screenshots, code snippets etc.)

https://mdbootstrap.com/snippets/standard/softcon/3667742


Michał Duszak staff answered 2 years ago


Hello, you can do something like this to your first option. Users won't be able to select it, but initially it will force placeholder to show.

                    <option hidden value=""></option>

Here is the snippet: https://mdbootstrap.com/snippets/standard/m-duszak/3668522


softcon premium commented 2 years ago

Thanks, this was a good solution



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.2
  • Device: PC
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes