aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2015-08-26 23:31:44 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2015-08-26 23:31:44 +0200
commit7d3c1b0d13c8d060c220bcccbce705f05be398d0 (patch)
tree510002fcae7feec63666c10f9a763759be16434b /js
parentBug 1197436: A remembered search with a ' cannot be edited or deleted (diff)
downloadbugzilla-7d3c1b0d13c8d060c220bcccbce705f05be398d0.tar.gz
bugzilla-7d3c1b0d13c8d060c220bcccbce705f05be398d0.tar.bz2
bugzilla-7d3c1b0d13c8d060c220bcccbce705f05be398d0.zip
Bug 1196969: Custom fields whose visibility depends on the product are not displayed/hidden correctly
r=gerv a=sgreen
Diffstat (limited to 'js')
-rw-r--r--js/field.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/js/field.js b/js/field.js
index c90ececf6..e4744f5e0 100644
--- a/js/field.js
+++ b/js/field.js
@@ -522,6 +522,31 @@ function handleVisControllerValueChange(e, args) {
if (selected) {
YAHOO.util.Dom.removeClass(label_container, 'bz_hidden_field');
YAHOO.util.Dom.removeClass(field_container, 'bz_hidden_field');
+ /* If a custom field such as a textarea field contains some text, then
+ * its content is visible by default as a readonly field (assuming that
+ * the field is displayed). But if such a custom field contains no text,
+ * then it's not displayed at all and an (edit) link is displayed instead.
+ * This is problematic if the custom field is mandatory, because at least
+ * Firefox complains that you must enter a value, but is unable to point
+ * to the custom field because this one is hidden, and so the user has
+ * to guess what the web browser is talking about, which is confusing.
+ * So in that case, we display the custom field automatically instead of
+ * the (edit) link, so that the user can enter some text in it.
+ */
+ var field_readonly = document.getElementById(controlled_id + '_readonly');
+
+ if (!field_readonly) {
+ var field_input = document.getElementById(controlled_id + '_input');
+ var edit_container =
+ document.getElementById(controlled_id + '_edit_container');
+
+ if (field_input) {
+ YAHOO.util.Dom.removeClass(field_input, 'bz_default_hidden');
+ }
+ if (edit_container) {
+ YAHOO.util.Dom.addClass(edit_container, 'bz_hidden_field');
+ }
+ }
// Restore the 'required' attribute for mandatory fields.
if (field.getAttribute('data-required') == "true") {
field.setAttribute('required', 'true');