After a form validation, if there is an error in a chosen field, the field is not highlighted.
This is because the select field (which is correctly highlighted) is hidden and replaced with the chosen widget.
The chosen wiget should inherit the error class.

CommentFileSizeAuthor
#6 chosen-example.png45.4 KBPascal-
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stephane-v created an issue. See original summary.

stephane-v’s picture

Issue summary: View changes
stephane-v’s picture

Title: select field highlight is not show after form validation error » select field highlight does not show after form validation error
DanieleN’s picture

Can't reproduce this. (core 8.5.0 and chosen 8.x-2.5)

After submit a form the error show correct.

Please reopen this issue

DanieleN’s picture

Status: Active » Closed (cannot reproduce)
Pascal-’s picture

FileSize
45.4 KB

Running into this issue as well.
The problem is not that the error is not showing up.
The problem is that it is not possible to style the chosen-container differently when there is an error since it does not copy the error class from the select list.

First div is a normal text field that works properly (with an error)
Second div is the chosen field, you can see the select element has the error class, but the chosen-container does not copy the error class, making it very hard to style it.

error example

Pascal-’s picture

Priority: Major » Normal
Status: Closed (cannot reproduce) » Active
Pascal-’s picture

Title: select field highlight does not show after form validation error » Chosen form element does not receive the error class from the select element
Pascal-’s picture

Temp fix:

.form-select.error ~ .chosen-container  { margin-top: 15px;
  a,
  .chosen-drop                            { border-color: #c43838; }
}
apaderno’s picture

Assigned: stephane-v » Unassigned
Issue tags: -select highlight validation validate