Jump to content

Trigger Onblur Event Even With Very Fast Clicking?


akphidelt2007

Recommended Posts

Ok, so here is my little dilemma. I have a table that acts as a spreadsheet and allows the user to click a cell and pops open an input box. And when a blur event is triggered on the input box it runs some ajax to submit the data in to the database and then closes the input box and adds that value to the cell. My problem is, if I click really really fast on multiple cells, multiple input boxes pop up and the blur event is not triggered.

 

Is there a way to handle this type of action. I know it's nitpicky, but I can just imagine some of our engineers clicking too fast and getting this little bug.

 

Please let me know if there is anything I can do about this.

 

Thanks in advance!

Ok, so here is my little dilemma. I have a table that acts as a spreadsheet and allows the user to click a cell and pops open an input box. And when a blur event is triggered on the input box it runs some ajax to submit the data in to the database and then closes the input box and adds that value to the cell. My problem is, if I click really really fast on multiple cells, multiple input boxes pop up and the blur event is not triggered.

 

Is there a way to handle this type of action. I know it's nitpicky, but I can just imagine some of our engineers clicking too fast and getting this little bug.

 

Please let me know if there is anything I can do about this.

 

Thanks in advance!

 

 

As there's no code I would suggest one of the following:

  1. Set a flag when an input box is opened. Then at the start of your click function do a check to see if that flag is true and if it is then don't continue running the click function. So this way you constrain the user to only having one input active at any one time. Then on blur you can reset the flag.
     
     
  2. Another option might be to set a timer so that the function cannot be run again until say 1-2 seconds has elapsed.

Hope those suggestions help a bit!

Thanks for your replies.

 

Drongo, I actually ended up with your advice by pure accident. When a user was clicking in to the text box it would create another text box, so I built that flag to make sure that an active box was already present and if it was then skip the code process. That ended up doing the trick.

 

Thanks again

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.