G
Gene Wirchenko
Dear JavaScripters:
Does using alert() cause input control events to fire?
I am writing some validation routines where I want the control to
keep the focus if the test fails. (Yes, I know that this is
desktop-app style. That is what I want.)
Actually, if onblur fires, the focus has already moved. To get
around this, I have a global that is set if validation is already
occurring on another input control. In that case, I simply bypass the
validation on the second control so that the focus can be set back.
This works (IE 9 & Windows 7).
It seems that the order of statements is important. I have to
set the focus back before generating the error alert. Otherwise, it
does not work right, and I can get the other input control's
validation routine getting in the way. I also had the hilarity of my
debugging alert() statements affecting the program flow.
It seems to me that alert() might cause input control events to
fire. Is this so? If so, is it guaranteed to be like this, or is it
just IE 9's implementation? How tied to implementation is this error
handling making my code?
Sincerely,
Gene Wirchenko
Does using alert() cause input control events to fire?
I am writing some validation routines where I want the control to
keep the focus if the test fails. (Yes, I know that this is
desktop-app style. That is what I want.)
Actually, if onblur fires, the focus has already moved. To get
around this, I have a global that is set if validation is already
occurring on another input control. In that case, I simply bypass the
validation on the second control so that the focus can be set back.
This works (IE 9 & Windows 7).
It seems that the order of statements is important. I have to
set the focus back before generating the error alert. Otherwise, it
does not work right, and I can get the other input control's
validation routine getting in the way. I also had the hilarity of my
debugging alert() statements affecting the program flow.
It seems to me that alert() might cause input control events to
fire. Is this so? If so, is it guaranteed to be like this, or is it
just IE 9's implementation? How tied to implementation is this error
handling making my code?
Sincerely,
Gene Wirchenko