Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture closing confirm dialog box - if user clicks X not cancel

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I often use confirm() to give user one final chance to accept or cancel an action. Prior to confirm(), I block screen by changing properties on a layer which effectively blocks the entire screen - Using opacity, the user can still see the screen content but nothing can be clicked on.

For the first time ever I decided to just close the confirm() dialog box and was stunt to find that the script neither reads it as OK nor CANCEL ... and my content remains blocked.

This is NOT good!!! I am sure you can see why.

Is there a way to capture this or am I dunned and will have to change my methods?


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
If I the X button on a confirm dialog, I get a "false" just the same as using the Cancel button.

How are you checking for the returned value?


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I stand corrected, I am getting a JS error I just missed it ... :(

Debugging an application, figured it helps if I clear the error console and refresh the browser to make sure all is clean; this helped spot the error which I have corrected.

Thanks!



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Hi

SouthBeach said:
Prior to confirm(), I block screen by changing properties on a layer which effectively blocks the entire screen
You mean [tt]window.confirm()[/tt] ? Interesting. I know about no browser where the document can be modified while the [tt]confirm()[/tt] dialog is active. Why that blocking layer ?

Feherke.
 
feherke,

That is because it is part of a standard in my development practice.

I also use layers for some of these things (in lieu of JS) where I popup a layer with a few options and trigger methods based on chosen option. I like the use of layer because it makes for a better looking dialog but it is more work ...

So, to make all instances where a user response is expected, I tend to block the screen (which changes its background opacity). When using JS methods it is not a matter of disabling page functions but to provide the visual I would expect user to grow used to.





--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top