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 8168323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:29:07+00:00 2026-06-06T20:29:07+00:00

What I have is 2 functions (edit and save), which are event handlers bound

  • 0

What I have is 2 functions (“edit” and “save”), which are event handlers bound respectively to click and blur events of table cells.
Basically “edit” replace the content of the cell by an input with the same content, and save do the opposite, both with some ajax calls to update the DB.

That works pretty fine. Problem is that now I want to “link” 2 cells so when I change the value of the first one, the second one is updated according to the value of the first one.

That is almost working, except in one case : Let’s say I edit cell#1, make some changes to the value, and then click on the second one.
What’s happening is that the blur event is triggered on the cell#1, calling the “save” function, which make the first cell back to a normal state with the new value, and also change the value of cell#2.

But the click event is also triggered on cell#2 because I just clicked on it, so “edit” is called and start processing, before “save” is finished and has done the change to cell#2.

What I would like is that “edit” on cell#2 wait for save to be completed before it starts, so it will have the right value.

I read some things about synchronizing events in JS etc… but I’ve not apply it successfully to my problem so far.

Can anyone help me ?

Thanks

  • 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-06-06T20:29:09+00:00Added an answer on June 6, 2026 at 8:29 pm

    For every ‘edit’ action, you should probably apply a precondition that mandates that the previous ‘save’ action if any is complete.

    For example:

    $('...').click(function() {
    
        // precondition
        if(saveInProgress) return false;
    
        // .. you code to switch to edit mode ...
    
    });
    
    $('...').blur(function() {
    
        // precondition
        if(saveInProgress) return false;
    
        // AJAX call for saving
        doSave();
    
    });
    
    var saveInProgress = false;
    function doSave() {
    
        saveInProgress = true;
        $.ajax(...,
            success: function() {
                // ... your code ...
                saveInProgress = false;
            },
            error: function() {
                // ... your code ...
                saveInProgress = false;
            }
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an edit text which functions as a search box in my application.
I have a function that allows users to edit a row in a table
I have an HTML table where I'm building an edit function to change a
I am using jEditable to edit a table inline, the third column of which
I have a table with a quick edit function (updates only one field using
I have a 1:M relationship of Events with Event Dates. In the EventForm class,
I have a method to save an image, which is meant to deal gracefully
I have this function to edit all fields that come from the form and
I have a function that will allow me to edit the manager property of
I have following function in one Activity public void AppExit() { Editor edit =

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.