aboutsummaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2015-08-06 16:57:45 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2015-08-06 16:57:45 +0200
commit6f616e1306bf385d0f8e1190c1a02aa957e1ca89 (patch)
treebd5b4fe20163584e2e9faf1369d22685989945e3 /js
parenta2ae154592af0131e13f935802839679e4e88924 (diff)
downloadbugs-6f616e1306bf385d0f8e1190c1a02aa957e1ca89.tar
bugs-6f616e1306bf385d0f8e1190c1a02aa957e1ca89.tar.gz
bugs-6f616e1306bf385d0f8e1190c1a02aa957e1ca89.tar.bz2
bugs-6f616e1306bf385d0f8e1190c1a02aa957e1ca89.tar.xz
bugs-6f616e1306bf385d0f8e1190c1a02aa957e1ca89.zip
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.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/js/field.js b/js/field.js
index 2193c40eb..c90ececf6 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');
+ }
}
}