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.)

https://mdbootstrap.com/snippets/standard/itam/4425667


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

https://mdbootstrap.com/snippets/standard/ochicaud/4676649#html-tab-view


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: https://mdbootstrap.com/snippets/standard/kpienkowska/4426584


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.

FREE CONSULTATION

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

Status

Answered

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