Topic: select cannot select blank option

Alistair Wilson priority asked 1 year ago

Expected behavior

Should be able to select the blank item after having another item selected from the server. It's important blank item work with validation still and trigger required when selected.

Actual behavior

Last option gets displayed in the select control instead of blank

Resources (screenshots, code snippets etc.)

Alistair Wilson priority answered 1 year ago

Just adding this css fixed the issue I was having.

.select-fake-value { visibility: hidden; }

ochicaud priority commented 1 year ago

this tip works. but I hope it's just a temporary patch. There is definitely a bug. this bug is still here 06 dec 2022, mdb v 6.0.1

if selected is not used, we can select the blank option if selected is used, we can not select the blank option

Kamila Pieńkowska staff answered 1 year ago

The solution is to put something as value. Then you can validate the value since it is not empty. Here is your example adjusted:

Alistair Wilson priority commented 1 year ago

The trouble with that solution is that the validation passes however no value was selected

Kamila Pieńkowska staff commented 1 year ago

You need to add a javascript that will assess "blank" as invalid.

Alistair Wilson priority commented 1 year ago

How do I get the validation to show then, since the control seems to have it's own?

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 5.0.0
  • Device: desktop
  • Browser: Edge 105
  • OS: windows 10
  • Provided sample code: No
  • Provided link: Yes