From df0a246760aa68d0462ea967bcf3b48121f2a665 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 10 Sep 2014 16:33:19 +0200 Subject: [PATCH] Fixed the templates with equal min and max as 0. TICKETS #1245 --- .../alerts/configure_alert_template.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 592e728bad..287449d756 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -745,7 +745,16 @@ if (!$disabled) { } else { html_print_input_hidden ('step', $step + 1); - html_print_submit_button (__('Next'), 'next', false, 'class="sub next"'); + if ($step == 2) { + //Javascript onsubmit to avoid min = 0 and max = 0 + + html_print_submit_button(__('Next'), 'next', false, + 'class="sub next" onclick="return check_fields_step2();"'); + } + else { + html_print_submit_button(__('Next'), 'next', false, + 'class="sub next"'); + } } } @@ -774,6 +783,24 @@ var critical = ; var onchange_not = ; var unknown = ; +var error_message_min_max_zero = ; + +function check_fields_step2() { + var correct = true; + + type = $("select[name='type']").val(); + min_v = $("input[name='min']").val(); + max_v = $("input[name='max']").val(); + + if (type == 'max_min') { + if ((min_v == 0) && (max_v == 0)) { + alert(error_message_min_max_zero); + correct = false; + } + } + + return correct; +} function check_regex () { if ($("#type").val() != 'regex') {