cancel
Showing results for 
Search instead for 
Did you mean: 

Confirmation PopUP

Former Member
0 Kudos

Hai Community,

I wanted to have a data loss popup in my application like the one in the CRM system.

So,I have created a window that works like the conformation popup window and shows to the user.

My problem is:

If the user presses "Yes" "No" or "Cancel" How do I proceed further.

I mean after handling the routines for "Yes" "No" and "Cancel" I wanted to processed with my earlier event.

How can I do it and what are the possible ways?

Regards,

Venkatesh

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I have used the following in the past. I tie a server side and client side event to my HTMLB button for instance. The client side event fires the following script:

//************************************************************************************
function Ask_User(strMessage, strDefault){
    strAnswer = window.confirm(strMessage);
}

function Task_Button(strID, htmlbevent){
//***************************************************************************
//***  This function will handle events when the user selects one of the different
//***  buttons on the action detail screen.  User is prompted on Completion and
//***  N/A request to make sure that is what they want.
    var strMyMessage;
    var strMyDefault;
    var intWork;
    var strInput;
  switch( strID ){

        case "abondon":

            strMyMessage =
               "Are you sure you want to abandon changes ?";
            strMyDefault = "no";
            Ask_User(strMyMessage, strMyDefault);

            if (strAnswer){
                htmlbevent.cancelSubmit = false;
            }else{
                htmlbevent.cancelSubmit = true;
            }
            return true;
...
   }
}
//********************************************************************

</script>

Message was edited by: Thomas Jung

Former Member
0 Kudos

Hai Thomas,

Thanks for ur reply,

If you can be a little more detailed about the code Sorry I did get it properly.

and

Here I require two server events,

like

if the user is editing one record and changed to other record.

Ill check for the changes on the server and display the Dialog popwindow, if there are any changes,

Based on the input I proceed further.

and

Sergio the modelDialog that I have prepared was with html and javascript that works on IE and NS,which is similar to the one in msdn.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Your talking about going back to the server before you even throw the dialog window. My solution is a simple prompt that is fired when you press a <htmlb:button>. When the user presses the button, the client side prompt fires first. The htmlbevent.cancelSubmit = true/false; - is the key. This tells the BSP client side runtime if you still want the server event to fire.

For instance you are in change mode and the user hits the exit button. You might want to prompt them to save before they exit. This script could be attached to the exit button. If you have more data checking that needs to be done, you would obviously have to adapt the solution.

Former Member
0 Kudos

Yes thomas you got my problem right,

1. I am going to the server and checking for the changes

2. Displaying the popup if there is unchanged information

3. Displaying the popup.

4. if yes is pressed - Saving the data,If no-doing nothing

Now I dont understand how to proceed with my previous event.Coz All my other method are for server events and could not proceed futher unless I generate other event

or call event Dispatch event

or

If I can generate the same previous event when i press the Yes No on the Dialog, It works for me.

Can I use htmlbSubmitLib( ); for generating the event or anything wrong if I use it?

Regards,

Venkatesh

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It seems like you could just submit another server event from the client side after the user chooses Yes or No from the dialog. I wouldn't use htmlbSubmitLib( ); directly. Instead I would use <bsp:htmlbEvent> to generate the JavaScript for the Server Event call.

Former Member
0 Kudos

Hai thomas,

You are right But I wanted to generate the same event like that one of earlier.

With Htmlbevent I could raise server event and Handle the instructions for "save" or "no save".

But How can I continue with the things that I left in between,Like navigating to the next page or going for another search.All the details in the model will be same same except some variables that I use for Popup window.

If I can raise the previous event again then my problem ill be solved.

Regards,

venkatesh

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I guess I am missing something because I don't understand how you can go back to the server (server event handling I assume) and then show your client side popup, and then refire the same previous server event (or why you even need to refire the same event).

However it doesn't really matter. If the solution works for you - go for it! They only warning about working directly with the htmlbSubmitLib instead of the <bsp:htmlbEvent> is that you never know when SAP might change that. You also don't know how that might interact with other elements (such as the doubleSubmit element).

Former Member
0 Kudos

Assume I am navigating to other record unsaving the present record,

I have written code for navigating in evt_record_selection.

After displaying the popup,If I press yes Ill save the data.How can I execute execute the method evt_record_selection.

I have used dispatch_event_ex for event handling.

Regards,

Venkatesh

Former Member
0 Kudos

Hai,

I could solve the problem by storing the htmlb_event_ex in a variable and then calling the handler method statically passing the old htmlb_event_ex.

I wanted to know if it is possible to call the DO_HANDLER_EVENT again with the previous values from any other method.

Regards,

venkatesh.

Answers (1)

Answers (1)

RieSe
Contributor
0 Kudos

Hi,

have a look at:

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/showmodal...

If you have the chance to trigger javascript, you can call a modal window, procedd the user action and set the

event_id parameter.

Best regards,

Stefan

Former Member
0 Kudos

Thanks Stefan,

I have prepared a model Dialog similar to the one that in your link,

The problem I have is after the I clicks on

"Yes" or "No" or "Cancel".

I handle the events whatever for them,

But if I presses "yes" or "no" ,After handling their corresponding routines I should go on with my previous event.

May be navigating to other window or moving to other record or whatever.

How can I raise the previous event and handler their corresponding methods.

Hope got the problem, If u still have any problems understanding the issues do ask me.

Regards,

Venkatesh.

SergioFerrari
Active Contributor
0 Kudos

Hi, what about other browsers like Firefox, Safari?