Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1108457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:05:09+00:00 2026-05-17T02:05:09+00:00

I’m trying to write a custom in-window confirm dialog (based on jQuery UI) that

  • 0

I’m trying to write a custom in-window confirm dialog (based on jQuery UI) that we can use to control all aspects of the window (button text, etc). What I’d really like is for the control to behave exactly the way that the built-in confirm() function behaves (call confirm(), script execution pauses until the user clicks ok or cancel, confirm() returns true or false). I have looked around to find solutions for this, and the closes that I have come looks something like this:

//title = text to be displayed for title
//text = text to be displayed in body of dialog
//func = name of function to be called upon user selection, result will be passed as first parameter
function aw_confirm(title, text, func){
    <%= ClientID %>_retVal = null;
    <%= ClientID %>_func = func;
    <%= ClientID %>_show(title, text);
    <%= ClientID %>_waitForSelection(func);
}

function <%= ClientID %>_waitForSelection(func){
    if (<%= ClientID %>_retVal != null){
        var r = <%= ClientID %>_retVal;
        <%= ClientID %>_retVal = null;
        func(r);
    }
    else setTimeout("<%= ClientID %>_waitForSelection(<%= ClientID %>_func)", 10);
}

This is an aspx control, thus the <%= ClientID %>_ before everything in order to make sure that nobody overwrites the functions with code in other controls.

As you can see, this current setup requires the programmer to write a handler (here called func) to be called when the user makes a selection. What I’d really like is for aw_confirm() to just wait until the user makes a selection and then return. Is there a way to do this? Thanks in advance for any help or advice you can provide!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:05:10+00:00Added an answer on May 17, 2026 at 2:05 am

    Javascript is mostly event-based. The code reacts to events (a clicked button, a timer etc). JQuery UI also follows this paradigm. What you are trying is working against this and will be therefore quite hard if even possible. You should follow the event based approach.

    It doesn’t have to be much different from the code which uses confirm. If you had this:

    ret = confirm("Hello User")
    // do something
    

    you could now write

    aw_confirm("Hello user", "", function(ret){
      // do something
    })
    

    using an anonymous function as callback.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.