Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No workaroud validation when select is required #1148

Open
jasomdotnet opened this issue Mar 2, 2024 · 1 comment
Open

No workaroud validation when select is required #1148

jasomdotnet opened this issue Mar 2, 2024 · 1 comment
Labels

Comments

@jasomdotnet
Copy link

When <select> with Choices.js search is required and no option is selected, there is no message "Please fill the field" or any other action on form submit. Visitor has no clue where's the problem. Only console log contains msg:

The invalid form control with name=’required_select_name’ is not focusable.
An invalid form control is not focusable.

No class is added. For example Chosen jQuery plugin used to add following classes:

.chosen-container.error .chosen-choices,
.chosen-container.error .chosen-single {
    border: 2px solid red;
}

No configuration option is possible to made.

Similar bugs here:

#1070
#1061

Can you please fix this?

https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/setCustomValidity

@jasomdotnet jasomdotnet added the bug label Mar 2, 2024
@DavidPetrasek
Copy link

Solution:

.choices [hidden] 
{
  display: none !important; <--- REMOVE THIS
  
  ADD THIS:
  position: absolute;
  visibility: hidden;
  opacity: 0;
  z-index: -9999;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants