Home
Analytics
javascript on click button
birtprofi
Hi guys,
in JavaScript I am nearly a newbe. I use following javascript on "after render" the report
importPackage(Packages.java.io);
var log = new FileWriter("c:\\" + params["Datei"] + ".p", true);
log.write(output);
log.flush();
reportContext.setGlobalVariable("logWriter", log);
But I would like to render this script after click a button on my report. So I made a button like this:
<form name="link">
<input type=text size=100 value="no action">
<input type="button" value="script rendered" onClick="
document.forms['linka'].elements[0].value='?nderungen durchgef?hrt';
">
Could you tell me, how I have to integrate the javascript, that it run after pressing the button and not after render the report.
Best regards
Rafael
Find more posts tagged with
Comments
johnw
Two different types of Javascript here. The first example is server side, and runs on the BIRT server. The second is client side, and runs in the users browser. The two are not the same, and do not communicate with each other.
What exactly are you trying to get this to do?
birtprofi
Hi Johnw,
In my report I have a JavaScript variable called "output".
The content of var "output" should saved as specific text file. In my example it should saved as format "export.p"
My intention is, that the User run the Report, and if the Information is allright, then he press the button, and after this the file will be created and saved on the Client-Side.
rafael
johnw
Let me try to work up an example of this. I would like to post the result on my blog. I need to start updating it again
birtprofi
Hi John,
thank you for your efforts. Please give me the link to your blog.
kind regards
birtprofi
Hi John,
please tell me the link of your blog.
Kind regards
Rafael
birtprofi
Hi guys,
I solved the problems to save informations from the report to the clients PC with the following steps:
I use following server-side Javascript:
importPackage(Packages.java.io);
var log = new FileWriter("....\webapps\birt\documents" + params["Datei"] + ".p", false);
log.write(output);
log.flush();
reportContext.setGlobalVariable("logWriter", log);
And then I made in my Report a Hyperlink / Download Link to the birt runtime on the server, where the file is saved.
Now the user didn?t have any security problems and with the download link its no problem to save the file wherever the client wants.
best regards
rafael