cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Popup to avoid losing unsaved data

Former Member
0 Likes
1,640

Hi,

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.

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).

Can you help me with it?

Many thanks in advance

Carles

View Entire Topic
Former Member
0 Likes

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?

Many thanks

Former Member
0 Likes

Hi again,

that's the best of it - you hav nothing to do

If you have your button supplied with onClick like:


<htmlb:button id="..."
onClick = "YourEvent"
onClientClick = "confirm('Do you really want to?');" 
/>

... a Click will do the following:

1. confirmation dialog will be display waitig for a user action

2. a) when user clicks OK - the script returns TRUE and the request will be sent to the server

2. b) when user clicks CANCEL - the script returns FALSE and nothing happens

The BSP-eventlibrary looks automatically for these client events.

Regards,

Sebastian

(Sorry, wrote about htmlb:inputfield in my first post - I meant htmlb:button of course.)