<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Popup to avoid losing unsaved data in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432770#M1040980</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at this blog from Eddy, It will solve your problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/eddy.declercq/blog/2006/03/20/wake-me-up-before-you-go-go&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;*Reward each useful answer&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;Raja T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2007 14:13:00 GMT</pubDate>
    <dc:creator>raja_thangamani</dc:creator>
    <dc:date>2007-06-21T14:13:00Z</dc:date>
    <item>
      <title>Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaq-p/2432767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm developing a BSP where the user will modify data and I'd like a popup to appear when the 'Back' button is pressed and there have been usaved modifications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically it should be a popup with a 'You have modified the data. Are you sure you want to leave the page without saving?' or something like that and two buttons YES/NO (the yes button should execute an event and the no just close the popup).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me with it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Carles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 13:46:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaq-p/2432767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T13:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432768#M1040978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you talking about the Browser back button ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If yes, then i have a solution for Internet Explorer...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this : &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;html&amp;gt;
&amp;lt;script language = "javascript"&amp;gt;

window.onbeforeunload = bunload;
function bunload(){
  mess = "You will lose all information providednduring navigation of this site";
  return mess;
}
function confirmEvent()
{
	alert("Function called");
	if(!confirm('Do you really want to proceed?'))
	{
		window.onbeforeunload = false
		return false;
	}
}
function test()
{
alert("Hellio");
document.frm.t1[2].style.background = "rgb(231,220,24)";
var arr = document.frm.elements;
var i;
for(i=0;i&amp;lt;arr.length;i++)
{
	if(arr&amp;lt;i&amp;gt;.type == "text")
	{
		if(!arr&amp;lt;i&amp;gt;.disabled)
		{
			alert(arr&amp;lt;i&amp;gt;.value);
		}
	}


}
alert(document.frm.t1[3].value);
}
&amp;lt;/script&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;form name="frm"&amp;gt;
&amp;lt;input type="text" name="t1" size=5 value="Hello1" disabled="true"&amp;gt;
&amp;lt;input type="text" name="t1" size=5 value="Hello2" style="font-family: Verdana;font-size: 10; align=middle; height: 17px;border: solid rgb(220,225,260) 1px"&amp;gt;
&amp;lt;input type="text" name="t1" size=5 value="Hello3"&amp;gt;
&amp;lt;input type="button" name="b1" value="Click here" onClick="test()"&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 13:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432768#M1040978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T13:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432769#M1040979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, but I think I explained myself wrong. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I said 'Back' button I meant a button created with htmlb:button. It's whenever I click that button that the event should be triggered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Carles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 14:06:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432769#M1040979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T14:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432770#M1040980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Look at this blog from Eddy, It will solve your problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/eddy.declercq/blog/2006/03/20/wake-me-up-before-you-go-go&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;*Reward each useful answer&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;Raja T&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 14:13:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432770#M1040980</guid>
      <dc:creator>raja_thangamani</dc:creator>
      <dc:date>2007-06-21T14:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432771#M1040981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use onClientClick attribut of htmlb:button, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;htmlb:inputField id="..."&lt;/P&gt;&lt;P&gt;                          onClientClick = "confirm('Do you really want to?');" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sebastian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 06:44:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432771#M1040981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-22T06:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432772#M1040982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sebastian, that's what I needed. But now, how I process the event? I mean, where do I write the subsequent code for the Accept and Cancel buttons?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 07:57:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432772#M1040982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-22T07:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432773#M1040983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that's the best of it - you hav nothing to do &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have your button supplied  with onClick like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;htmlb:button id="..."
onClick = "YourEvent"
onClientClick = "confirm('Do you really want to?');" 
/&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... a Click will do the following:&lt;/P&gt;&lt;P&gt;1. confirmation dialog will be display waitig for a user action&lt;/P&gt;&lt;P&gt;2. a) when user clicks OK - the script returns TRUE and the request will be sent to the server&lt;/P&gt;&lt;P&gt;2. b) when user clicks CANCEL - the script returns FALSE and nothing happens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The BSP-eventlibrary looks automatically for these client events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sebastian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(Sorry, wrote about htmlb:inputfield in my first post - I meant htmlb:button of course.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 08:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432773#M1040983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-22T08:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Popup to avoid losing unsaved data</title>
      <link>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432774#M1040984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've written the code inside the onClientClick:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;onClientClick = "if(confirm('Do you really want to?')){document.location.href='main_gestors.htm?NUMPERS=&amp;lt;%= numpers %&amp;gt;';}"&lt;/P&gt;&lt;P&gt;and it does what I wanted&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to you all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2007 08:24:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/popup-to-avoid-losing-unsaved-data/qaa-p/2432774#M1040984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-22T08:24:41Z</dc:date>
    </item>
  </channel>
</rss>

