...

View Full Version : Multiple event invocation onblur and onclick



contactanantha
03-14-2012, 01:23 PM
Hi,

I have a problem in javascript, where entering a value in the textbox during onblur I am doing a refresh to bring in the
updated records from the DB , before the on blur refresh is completed if the user clicks the search button (onclick)
during the first click nothing is happening as the refresh is still going on. During the second click when the on blur refresh
is completed it will open a popup.

The problem here is I am unable to disable/inactivate the search button untill the refresh is completed as well as I dont have any control over the
refresh time as well. This is like already an event is in progress and where we are invoking another event which is not having
any effect. In such case how i can handle this scenario?

Thanks.

felgall
03-14-2012, 08:28 PM
If you use event listeners instead of event handlers then you will be able to detach events when you don't want them to run and reattach them when you do.

glenngv
03-15-2012, 08:20 AM
Why are you doing a page reload on blur? Why not just use AJAX?

webdev1958
03-15-2012, 08:34 AM
Why not just use AJAX?

The op might be coding the functionality for when javascript is turned off or not available on the user's device.

contactanantha
03-15-2012, 08:51 AM
Thanks Guys. I am doing an AJAX call on on blur , please provide some example on the same using event listeners as supposed to event handlers.

glenngv
03-15-2012, 12:04 PM
Thanks Guys. I am doing an AJAX call on on blur , please provide some example on the same using event listeners as supposed to event handlers.
Then disable the Search button by default and then when the AJAX response is available, enable it. If you are using jQuery ajax, you enable the button in the 'complete' callback. If you are just using plain AJAX, you enable the button when xmlhttpObj.readyState == 4.

contactanantha
03-15-2012, 03:23 PM
Thanks. That is the easier option but that is not accepted by the client. Hence is there other way around it. Please explain. This is pretty urgent. Thanks.

glenngv
03-15-2012, 03:42 PM
I'm wondering why the client doesn't accept that solution.

webdev1958
03-16-2012, 12:10 AM
.....This is pretty urgent......

It's just about 9 hrs since your last post.

When do you need it by?

contactanantha
03-16-2012, 08:13 AM
Guys, I am trying this pretty hard with little luck any help is highly appreciated.
Hope I get a better luck this time and BTW this is my first post in this forum. Please provide a helping hand. Thanks.

contactanantha
03-18-2012, 07:53 PM
Any solution for this?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum