Show Alert Window based on lnput Control Validation in Jasper Server

Requirement: Create a Pop Up alert box based on Input Control Validation in Jasper Server.

In order to achieve above scenario,please follow the below steps:

  • Created one report in jasper studio having two input controls having integer type as RangeA and RangeB.
  • Set default value to both input control as RangeA=50 and RangeB=10.
  • Created one jsp page as “AlertWindow.jsp” having javascript code for alert box based on below condition like RangeB value should never be greater than RangeA value if it is greater then show alert box.

JavaScript Code

var count ; // To set seconds
var RangeA; // To set RangeA input control value
var RangeB; // To set RangeB input control value
/* Function to setTimeout for applying javascript after report load*/

var counter=setTimeout(function() {

jQuery(“#RangeA input”).addClass(“RangeA”); // Add class “RangeA” to RangeA input(Taken id from firebug)
jQuery(“#RangeB input”).addClass(“RangeB”); // Add class “RangeB” to RangeB input(Taken id from firebug)

/* Get value of input text using class*/

console.log(“RangeA”+RangeA+”–RangeB”+RangeB); //console log value to check values

function changeValue(cl) {
/* OnChange event function on RangeB input to show alert window when RangeA value less than RangeB and ViceVersa*/

if (jQuery(‘.RangeB’).val()>jQuery(‘.RangeA’).val()) //If condition when RangeA value less than RangeB

alert(“RangeA percentage should be higher than RangeB percentage value”); //Alert box message
document.getElementById(“apply”).disabled = true;

document.getElementById(“apply”).disabled = false;
}); //End of OnChangeevent function

}, 10000);

  • Placed “AlertWindow.jsp” at location “/WEB-INF/jsp/modules/inputControls/”.
  • Deployed report on jasper server by assigning Min and Max value range to in input controls as
    RangeA : 50 to 90
    RangeB : 10 to 90
  • After addition of input controls to report on jasper server , you can see the Optional JSP Location section under “Controls & Resources” , add the “AlertWindow.jsp” path shown below :


  • Submit the report and open the report , where you can the report with two input controls.
  • Now try to change the RangeB value any value which is greater the RangeA value and should be less than 90 according to range.
  • When to set value of RangeB greater than RangeA because of OnChange event you can see the Alert Box showing message as below which will be the expected output:



Satya Gopi,
BI Developer

Leave a Reply