diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2015-08-06 16:56:24 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2015-08-06 16:56:24 +0200 |
commit | 684bee48e1356c46aee7c1366c6ac03629528231 (patch) | |
tree | a547bdbe2e0802ffaa007b41811a5ebd6da3490a /js | |
parent | baed5713d175eee3fe2aed9ee3afef916b4641d4 (diff) | |
download | bugzilla-684bee48e1356c46aee7c1366c6ac03629528231.tar.gz bugzilla-684bee48e1356c46aee7c1366c6ac03629528231.tar.xz |
Bug 1183398: Mandatory custom fields block form submission if they are hidden and have no value
r=gerv a=dkl
Diffstat (limited to 'js')
-rw-r--r-- | js/field.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/js/field.js b/js/field.js index 5a48db471..5055c003e 100644 --- a/js/field.js +++ b/js/field.js @@ -506,7 +506,8 @@ function handleVisControllerValueChange(e, args) { var controller = args[1]; var values = args[2]; - var label_container = + var field = document.getElementById(controlled_id); + var label_container = document.getElementById('field_label_' + controlled_id); var field_container = document.getElementById('field_container_' + controlled_id); @@ -521,10 +522,20 @@ function handleVisControllerValueChange(e, args) { if (selected) { YAHOO.util.Dom.removeClass(label_container, 'bz_hidden_field'); YAHOO.util.Dom.removeClass(field_container, 'bz_hidden_field'); + // Restore the 'required' attribute for mandatory fields. + if (field.getAttribute('data-required') == "true") { + field.setAttribute('required', 'true'); + field.setAttribute('aria-required', 'true'); + } } else { YAHOO.util.Dom.addClass(label_container, 'bz_hidden_field'); YAHOO.util.Dom.addClass(field_container, 'bz_hidden_field'); + // A hidden field must never be required, because the user cannot set it. + if (field.getAttribute('data-required') == "true") { + field.removeAttribute('required'); + field.removeAttribute('aria-required'); + } } } |