on 10-05-2005 6:01 AM
Hi experts,
i want to have an OnUnload event within my BSP
but I only know a OnLoad attribut in the <htmlb:documentBody>.
Is it possible to do a OnUnload?
For example: "Do you really want to leave this page?" -Yes-No Case (I'm familiar with the JS Part)
kind regards
Marcus
You can also use the attributeBee-attribute of the <htmlb:documentBody>-Tag. There you can insert any bee that contains additional attribute definitions for your body-tag.
The definition of the bee might look like that:
DATA:
lr_unloadbee TYPE REF TO cl_bsp_bee_table.
CREATE OBJECT lr_unloadbee.
lr_unloadbee->add_html( html = 'onUnload="doAnythingHere()"' ).
But the questions you gave as an example is not that easy to implement, as the onUnload-event can't be canceled.
regards,
Martin
Message was edited by: Martin Schöffler
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcus,
you have to add it to your <htmlb:documentBody>-tag.
Like this:
<htmlb:documentBody attributeBee="<%=lr_unloadbee%>">
For the code to work you either have to make the definition of the bee in the view or you have to provide it to the view using a page attribute. In my case lr_unloadbee is the name of the page attribute.
The second question is a bit tougher. I don't know why it can't be canceled.
I usually use microsofts dhtml reference for any questions regarding html.
The page for the onUnload-Event: http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onunload.asp
If you work in an InternetExplorer-only environment you can use the onBeforeUnload-Event. This one can be canceled.
Hi,
We use this simple JS for warning people when the leave the app/popup without saving:
<script language="JavaScript">
var needToConfirm = false;
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
return "Any change will be lost if you don't save when leaving the application.";
}
</script>
Eddy
Hai Marcus,
http://www.4guysfromrolla.com/webtech/100604-1.shtml
this has a nice example which prompts the user to save the page when the user wants to leave the page with out saving.
Regards,
Venkatesh
Hi everyone,
now the problem is solved.
I did it with an iFrame on an normal html-site.
<htmlb:content design="design2003">
<htmlb:document>
<htmlb:documentHead>
<SIEHTMLB:textEditHeader/>
<script language="JavaScript">
var needToConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
return "This will close the application!";
}
</script>
</htmlb:documentHead>
<htmlb:documentBody>
<iframe src="main.do"
name="NameApplication" width="100%" height="100%" marginheight="0" marginwidth="0" align="center">
<p>Your Browser cannot show embedded Frames</p>
</iframe>
</htmlb:documentBody>
</htmlb:document>
</htmlb:content>
Thats all --- Thanks for every answer!
Regards,
Marcus
Message was edited by: Marcus Pohl
Hi Marcus,
You can just add on a HTML <body> tag. See the sample code below it will solve your issue.
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<head>
<SCRIPT language="JavaScript">
function test()
{
alert("Hi");
}
</SCRIPT>
</head>
<body onunload="test()">
<htmlb:content design="design2003" >
<htmlb:page title="Java script onunload test " >
<htmlb:form>
<htmlb:textView text = "Hello World!"
design = "EMPHASIZED" />
<htmlb:button text = "Press Me"
onClick = "myClickHandler" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
</body>
Hope this helps,
Regards,
Ravikiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
check the sample bsp application:
HTMLB_samples
look at:logoff.htm
its a good sample you can use it and modify it.
Regards,
Hemendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.