final WebApplication currentWebApp = (WebApplication)Application.current();
//only need to do this once
currentWebApp.clientSideIncludeFile("myJavascriptFunctions.js");
Later on to call your functions:
currentWebApp.clientSideMethodCall(...)
currentWebApp.clientSideMethodCallWaitForReturn(...);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanx, but can you explain how to use it.
I dont have a form to submit, this is the action i want to execute:
function throwsapevent() {
document.[here would be a form].action = "SAPEVENT:CLOSE";
document.[here would be a form].submit();
}
So which Arguments do I have to add to the method clientSideMethodCall?
Thanks a lot for your help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After a few hours I found the solution:
I created a .js file:
function throwsapevent(id) {
document.write("<form name=\"sapevent\">");
document.sapevent.action = "SAPEVENT:CLOSE";
document.sapevent.submit();
}
Imported the file at the beginnen of the webapp:
final WebApplication app = (WebApplication)Application.current();
app.clientSideIncludeFile("close_sapevent.js");
Calling the Method:
final WebApplication currentWebApp = (WebApplication)Application.current();
currentWebApp.clientSideMethodCall((Integer)null, "throwsapevent", new Object[]{});
Maybe another one can need it in future...
Thanx for you help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
Is there a way to call a javascript function, which is defined in a file on a button click or with Hyperlink.loadLocation?
thanks!
You can call a function with:
final WebApplication currentWebApp = (WebApplication)Application.current();
//only need to do this once
currentWebApp.clientSideIncludeFile("myJavascriptFunctions.js");
Later on to call your functions:
currentWebApp.clientSideMethodCall(...)
currentWebApp.clientSideMethodCallWaitForReturn(...);
Thanx, but can you explain how to use it.
I dont have a form to submit, this is the action i want to execute:
function throwsapevent() {
document.[here would be a form].action = "SAPEVENT:CLOSE";
document.[here would be a form].submit();
}
So which Arguments do I have to add to the method clientSideMethodCall?
Thanks a lot for your help!
Not an expert on javascript, you may want to search the forums for other answers:
http://sourceforge.net/forum/message.php?msg_id=4156540
You could also just display the page you want in a webrowser component.
After a few hours I found the solution:
I created a .js file:
function throwsapevent(id) {
document.write("<form name=\"sapevent\">");
document.sapevent.action = "SAPEVENT:CLOSE";
document.sapevent.submit();
}
Imported the file at the beginnen of the webapp:
final WebApplication app = (WebApplication)Application.current();
app.clientSideIncludeFile("close_sapevent.js");
Calling the Method:
final WebApplication currentWebApp = (WebApplication)Application.current();
currentWebApp.clientSideMethodCall((Integer)null, "throwsapevent", new Object[]{});
Maybe another one can need it in future...
Thanx for you help!