From 16c17224812f25eaadcdfa61ee4fab040df1edcb Mon Sep 17 00:00:00 2001 From: Mujuzi Moses Date: Tue, 8 Sep 2020 17:22:59 +0300 Subject: [PATCH 1/2] REPORT-495: Added an onkeyup event to the Widgets and Text input elements which disables and enables the smallButtons when the input elements have or don't have input respectively --- omod/src/main/webapp/run/runReportForm.jsp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/omod/src/main/webapp/run/runReportForm.jsp b/omod/src/main/webapp/run/runReportForm.jsp index 83e31fce8d..fe05155936 100644 --- a/omod/src/main/webapp/run/runReportForm.jsp +++ b/omod/src/main/webapp/run/runReportForm.jsp @@ -20,6 +20,23 @@ jQuery(document).ready( function toggleInputElements( idPrefix ){ jQuery( '.'+idPrefix ).toggle(); } + +/** + * TODO make disableButtons(idPrefix) an external function so that when widgets are + * used elsewhere but not in the Reporting module, they can access it. + */ +var disableButtons = function(idPrefix) { + var checkFixedValue; + checkFixedValue = jQuery('.' + idPrefix).val().length; + var checkExpression; + checkExpression = jQuery('#inputExpression.' + idPrefix).val().length; + + if (checkFixedValue > 0 || checkExpression > 0) { + jQuery('.' + idPrefix + '.smallButton').attr("disabled", "disabled"); + } else if (checkFixedValue == 0 || checkExpression == 0) { + jQuery('.' + idPrefix + '.smallButton').removeAttr("disabled"); + } + }