Link to home
Start Free TrialLog in
Avatar of Gaizka80
Gaizka80

asked on

Custom Alert / Confirm which waits for button click..?

I've been searching an answer for this question for a while. Still not getting any working solution..
To make mine web application UI and style comfortable, I've created my own alert- and confirm-boxes using
instructions at:
http://slayeroffice.com/code/custom_alert/

It works fine, if I don't want to redirect user after confirming the message with OK or Cancel.
It doesn't matter if I use custom alert or confirm, problem appears in both cases.
setTimeOut function or any other JS delay solution doesn't appear to work to freeze the application on alert-box.
It always disappears and redirects browser before clicking either OK or Cancel.

How can I possible force the JS application wait for user to click alert/confirm buttons??!
Is this even possible.. Any other "solutions" in this site doesn't seem to work..
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Can't you put your redirect code into the

      removeCustomAlert();

method?

Avatar of Gaizka80
Gaizka80

ASKER

I figured out that solution also by myself.

If I still would like to use custom alert like native JS alert i still need some kind of wait-function..
Is it possible?!

if ( customConfirm('Sure?') ) {
  // Do something
}

So can I make customConfirm wait for button click and use it as above?
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried that subModal-dialog, thank you for the link.

It's partly based on the same idea as customAlert, and it would possibly be better
solution if I need to show a lot of information (as in link page example) in modal window - I don't.

This modal window, as I tested it in practice, seems to be considerable slower than using customAlert.
I want my applications user actions to happen immediately. When using modal dialog, it seems just as it loads to another page.
It seems to have some scrolling problems too, that I already solved in my customAlert case.

Now that my customAlert & -Confirm seems to work well, I decide to remain on that solution too.
That subModal is still worth trying in some other case, it looks great.