on ‎2007 Jun 21 2:46 PM
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
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.)
Ok,
I've written the code inside the onClientClick:
onClientClick = "if(confirm('Do you really want to?')){document.location.href='main_gestors.htm?NUMPERS=<%= numpers %>';}"
and it does what I wanted
Thanks to you all!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, but I think I explained myself wrong.
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.
Carles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Are you talking about the Browser back button ?
If yes, then i have a solution for Internet Explorer...
Try this :
<html>
<script language = "javascript">
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<arr.length;i++)
{
if(arr<i>.type == "text")
{
if(!arr<i>.disabled)
{
alert(arr<i>.value);
}
}
}
alert(document.frm.t1[3].value);
}
</script>
<body>
<form name="frm">
<input type="text" name="t1" size=5 value="Hello1" disabled="true">
<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">
<input type="text" name="t1" size=5 value="Hello3">
<input type="button" name="b1" value="Click here" onClick="test()">
</form>
</body>
</html>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.