• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Custom Confirm Dialog

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if this is what you are asking:

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

eric
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic