# focusOut + Alert = HUGE Bug!

**URL:** <https://forum.kirupa.com/t/focusout-alert-huge-bug/195306>\
**Category:** Uncategorized\
**Created:** [July 30, 2006, 8:07pm UTC](https://forum.kirupa.com/t/focusout-alert-huge-bug/195306 "2006-07-30T20:07:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sttuffy](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sttuffy](https://forum.kirupa.com/u/sttuffy)\
**Post date:** [July 30, 2006, 8:07pm UTC](https://forum.kirupa.com/t/focusout-alert-huge-bug/195306/1 "2006-07-30T20:07:10Z")

</div>

I searched high and low on these forums and couldn’t find any mention of this, so I hope this will be helpful to somebody! 🙂

This code throws an infinite loop error:

```auto
IDListener.focusOut = function(eventObject) {
	Alert.show("blah blah", "ID Error!", Alert.OK, null, myClickHandler, null, Alert.OK);
};
ID.addEventListener("focusOut", IDListener);

```

But this code works fine:

```auto
IDListener.focusOut = function(eventObject) {
	ID.removeEventListener("focusOut", IDListener);
	Alert.show("blah blah", "ID Error!", Alert.OK, null, myClickHandler, null, Alert.OK);
	ID.addEventListener("focusOut", IDListener);
};
ID.addEventListener("focusOut", IDListener);

```

Thanks to [some random guy on a random blog](http://www.brandonellis.org/?currdate=5/31/2006) for figuring this out, I was about to lose my mind! :crazy:
