wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Custom Confirm Dialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Custom Confirm Dialog" Watch "Custom Confirm Dialog" New topic
Author

Custom Confirm Dialog

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I've managed to create some code that creates a dialog window with an OK button, a choice of 3 images (warn, error, info) and I made it modal using some other semi-transparent divs.

What I'd like to do now is create my own custom confirm dialog that has YES/NO buttons similar to how I've done everything else. I've seen examples on the web, but the ones I have found are commercial so I can't see the code.

What I need to figure out how to do is attach a function handler to the YES/NO buttons and somehow from my function I use to actually create and display the dialog, return true/false from that handler to said function.

I'm a bit out of my league on this though. Any helpful tips?


GenRocket - Experts at Building Test Data
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Not sure if this is what you are asking:

doucment.getElementById("idYes").onclick = functionName1Yes;
doucment.getElementById("idNo").onclick = functionName1No;

eric
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, basically, I have a funtion:



So yesClicked and noClicked return true/false appropriatly, but I really need showConfirm to return that true/false value.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
That is not going to happen. You are going to have to break your funciotn into two parts since there is no way to make JavaScript sleep. If you would look into an OO JavaScript it would be easier to implement in my eyes.

Eric
 
 
subject: Custom Confirm Dialog
 
Similar Threads
Javascript Module Pattern and Jquery live?
JQuery Dialog Box Positioning and Replacing X with Close
Problem - JDialog versus L&F
Passing Variables Through Callback
Java script dialog box