Commit f614976a authored by webchick's avatar webchick

Issue #2101427 by David_Rothstein, evilehk, nod_: Follow-up: Browser...

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 7c5e7f60
......@@ -215,6 +215,7 @@ public function getFormOptions($database) {
'#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 @@ public function getFormOptions($database) {
'#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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment