From 24cc45451a86a851d2e73d8741e6c51e78f640f5 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 16 Feb 2014 20:49:51 -0800 Subject: [PATCH] Make showHideByValue a bit less crash prone --- js/Common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/Common.js b/js/Common.js index 66b7c208b7..29198a3985 100644 --- a/js/Common.js +++ b/js/Common.js @@ -123,7 +123,7 @@ function showHideByValue(trigger_field_id, trigger_value, target_element_id, tar if (field_type == 'select') { var trigger = trigger_value.split("|"); - var selectedOptionValue = document.getElementById(trigger_field_id).options[document.getElementById(trigger_field_id).selectedIndex].value; + var selectedOptionValue = cj('#' + trigger_field_id).val(); var target = target_element_id.split("|"); for (var j = 0; j < target.length; j++) { @@ -150,7 +150,7 @@ function showHideByValue(trigger_field_id, trigger_value, target_element_id, tar if (field_type == 'radio') { var target = target_element_id.split("|"); for (var j = 0; j < target.length; j++) { - if (document.getElementsByName(trigger_field_id)[0].checked) { + if (cj('[name="' + trigger_field_id + '"]').is(':checked')) { if (invert) { cj('#' + target[j]).hide(); } -- 2.25.1