summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2013-11-14 20:37:16 (GMT)
committerwebchick2013-11-14 20:38:08 (GMT)
commitf614976af5bd66298964ca7a3faea19035e47b08 (patch)
treef99100e3450d45317dd0e252bb098c65356af76b
parent7c5e7f60e5407840ea0587cd959340d54607116e (diff)
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.
-rw-r--r--core/lib/Drupal/Core/Database/Install/Tasks.php2
-rw-r--r--core/misc/states.js6
2 files changed, 7 insertions, 1 deletions
diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index 04993bd..929dde8 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -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),
diff --git a/core/misc/states.js b/core/misc/states.js
index 81f4fcf..30a49dc 100644
--- a/core/misc/states.js
+++ b/core/misc/states.js
@@ -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();