In my work, I need to make some data input reports for end users. Then, I wish that a prompt box will appear after users' clicking the submitting button, and users can decide whether to submit data by clicking Ok or Cancel. With this prompt box, users can avoid incorrect manipulations.
Can anyone tell me how to make a prompt box for data submitting in input report?How to make prompt box for data submitting in input report with Java reporting tool?
Hi.
You can use RAQ Report to realize this requirement.
General idea:
1. Prompt box must be realized with Javascript. Therefore, we need to write lines of javascript codes and insert them into the JSP used for releasing the report.
2. Add a button in toolbar for the new function. As there is a default submitting button in the report already, it will be repeated if we add a new button here. Therefore, we need to shield the default submitting button or modify the Javascript function called by the default submitting button.
Operations:
Step 1: Modify toolbar.jsp, and add custom javascript codes.
Open toolbar.jsp(It is an independent JSP file used to save function button codes, and it is called in showReport.jsp which is used for displaying report. By modifying it, we can modify the tool bar in web page.), and add custom javascript codes for the prompt box as shown below:
%26lt; script language=';javascript';%26gt;function firm()//The name of the submitted function.{if(confirm(';Save?”))//Use the return value of the prompt box(true or false){//If it is true, call _submitTable( report1 ) to submit data._submitTable( report1 );return true;}else{//Else, cancel.alert(';You click cancel, and it will return to the web page.';);return false;}}%26lt; /script%26gt;With this easy piece of codes, we realize the prompt box. Next, we only need to modify the button to call this piece of codes. If we need other prompt boxes, the operations are all the same.
Step 2: Set the codes of submitting button as shown below:
Find the codes of submitting button in toolbar.jsp.
%26lt; a href=';#'; onClick=';_submitTable( report1 );return false;';%26gt;%26lt; %=submitImage%%26gt;%26lt; /a%26gt;
By default, submitting hyperlink is triggered by a defined image submitImage. When submitting, it will activate the build-in javascript in RAQ Report.
Now, we need to modify this line of codes to call the custom javascript codes written in step 1 as shown below:
%26lt; a href=';#'; onClick=';firm()';%26gt;%26lt; %=submitImage%%26gt;%26lt; /a%26gt;How to make prompt box for data submitting in input report with Java reporting tool?
Sounds to me like you want a popup.
What are you using to build these forms? Are they webpages? If so you would use a Javascript confirm box, a type of popup box. If you're using java Swing to build a custom GUI, then you would create a Popup Object.
See links below for more info.
No comments:
Post a Comment