2 Replies Latest reply on Sep 9, 2009 11:35 AM by Joe Beidelschies

    Events firing in infinite loop

    Joe Beidelschies



      I have two date fields (a start date and a due date) and a text field for the user to enter a duration between the two dates.  I've added separate event listeners for each component and the problem I'm having is when one field is updated, the event listener calculates the date for the other one as well and when the value changes, its event listener fires and changes the other date, causing an infinite loop.


      I've tried to remove the event listeners on the other components at the beginning of the listeners and adding them back at the end of the listeners, but the events still seem to fire when adding the listener.


      Is there an easy way to prevent event handlers from being run when you are changing one component's value from the event listener of another component?