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

  • SEARCH
  • Home
  • 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 868499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:08:58+00:00 2026-05-15T10:08:58+00:00

I’ve got a web page where I need a user to click the save

  • 0

I’ve got a web page where I need a user to click the save button to save the content of the form back to the web server.

Part of the save is a check of items which may require a prompt to the user that allows them to confirm, edit and reorder items in a javascript popup.

If the prompt is required, I need to be able to access the response from the user, i.e. was the confirm or the cancel button clicked, if the cancel button was clicked, the save process must be stopped, if the confirm button was clicked the save process must continue:

Psuedo code for synchronous behaviour:

function SaveData()
{

    if (itemsRequireValidation)
    {
        if (RESPONSE_CANCEL == ConfirmationDialog.Show()) {
            return;
        }
    }

    ProcessConfirmData(ConfirmationDialog.OutputData);

    //...Do the rest of the save process
}

Given that:

  • The confirmation dialog is a Javascript object that builds some HTML output, there is asynchronous behaviour introduced by way of the fact that we cannot really continue the process until the user clicks either the confirm or the cancel buttons contained within the dialog.

  • That blocking code to make the Javascript wait until the user clicks one or the other will have negative behaviour that could either crash the browser or prevent the user from even clicking either of the buttons.

How can I go about refactoring this to take into account the fact that the dialog box is essentially asynchronous, but I need to process the user interaction as if it were synchronous?

I think really I just need to look at this from another point of view that right now I’m not seeing.

  • 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-15T10:08:59+00:00Added an answer on May 15, 2026 at 10:08 am

    Use callbacks. Make your ConfirmationDialog allow callback functions as options, it can call those functions when the user responds.

    function SaveDate() {
    
      function HandleSave() {
        // process rest of save
      }
      if (itemsRequireValidation)
      {
        ConfirmationDialog.Show({
          RESPONSE_CANCEL: function() {
             // cancelled, do nothing
          },
          RESPONSE_OK: function(output) {
            ProcessConfirmData(output);
            HandleSave();
          }
        });
      } else {
        HandleSave();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I need to clean up various Word 'smart' characters in user input, including but
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.