Issue #2101427 by David_Rothstein, evilehk, nod_: Follow-up: Browser validation error with Chrome on hidden required fields, even on forms that don't allow client-side validation.
parent
7c5e7f60e5
commit
f614976af5
|
@ -215,6 +215,7 @@ abstract class Tasks {
|
|||
'#title' => t('Database name'),
|
||||
'#default_value' => empty($database['database']) ? '' : $database['database'],
|
||||
'#size' => 45,
|
||||
'#required' => TRUE,
|
||||
'#description' => t('The name of the database your @drupal data will be stored in.', array('@drupal' => drupal_install_profile_distribution_name())),
|
||||
'#states' => array(
|
||||
'required' => array(
|
||||
|
@ -228,6 +229,7 @@ abstract class Tasks {
|
|||
'#title' => t('Database username'),
|
||||
'#default_value' => empty($database['username']) ? '' : $database['username'],
|
||||
'#size' => 45,
|
||||
'#required' => TRUE,
|
||||
'#states' => array(
|
||||
'required' => array(
|
||||
':input[name=driver]' => array('value' => $this->pdoDriver),
|
||||
|
|
|
@ -517,7 +517,11 @@ $(document).bind('state:disabled', function(e) {
|
|||
$(document).bind('state:required', function(e) {
|
||||
if (e.trigger) {
|
||||
if (e.value) {
|
||||
$(e.target).attr({ 'required': 'required', 'aria-required': 'aria-required' }).closest('.form-item, .form-wrapper').find('label').append(Drupal.theme('requiredMarker'));
|
||||
var $label = $(e.target).attr({ 'required': 'required', 'aria-required': 'aria-required' }).closest('.form-item, .form-wrapper').find('label');
|
||||
// Avoids duplicate required markers on initialization.
|
||||
if (!$label.find('.form-required').length) {
|
||||
$label.append(Drupal.theme('requiredMarker'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$(e.target).removeAttr('required aria-required').closest('.form-item, .form-wrapper').find('label .form-required').remove();
|
||||
|
|
Loading…
Reference in New Issue