Problem with OnBlur calls

A

Amol

Hi all,
I need a way to disable 1 out of 3 functions called in my onblur
function. This is my scenario: I have a grid of 25 rows, each of which
has a input element for a quantity. The onblur() function for this
quantity calls 3 functions, 2 of which updates item costs on the same
row and the last one updates the total quantity in the header. For a
particular use case I need to update the quantity on each row by a
particular percent. So I loop through the table using HTML DOM, update
the quantity and call the onblur(). This updates the cost of the item
in the row but also calls the header summary function once for each
item. So the summary function is being called 25 times while calling it
just once would do the same thing. I added a flag to my computeHeader
function so that it is executed only when the flag is set to true. I
set the flag to false at the begining of my loop and set it to true
when I reach the last item in my loop. However when I run the code, it
looks the code for the entire loop gets already executed by the time
the computeHeader is invoked even for the first item from its onblur
function. As a result the computeHeader finds the flag as true and
hence calls it 25 times which is not what I want. Is there any other
way to disable the funtion OR make the loop call the onblur
syncronously before it goes to the next item?

Thanx in advance,
Amol.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top