Issue #1426646 by Ravi.J, xjm: Fixed '-Select-' option is lost when form elements uses '#states'.

8.0.x
webchick 2013-03-24 14:54:56 -04:00
parent 9d102d5dea
commit 4a78850e07
1 changed files with 3 additions and 1 deletions

View File

@ -2716,7 +2716,9 @@ function form_process_select($element) {
// preselecting the first option without intention. #multiple select lists do
// not get an empty option, as it would not make sense, user interface-wise.
else {
$required = $element['#required'];
// If the element is set to #required through #states, override the
// element's #required setting.
$required = isset($element['#states']['required']) ? TRUE : $element['#required'];
// If the element is required and there is no #default_value, then add an
// empty option that will fail validation, so that the user is required to
// make a choice. Also, if there's a value for #empty_value or