J
Jonathan N. Little
As part of a JavaScript precheck form validation I noticed a problem
with trying to return focus to the field with an error. I have setup a
demo page.
http://www.littleworksstudio.com/temp/usenet/focus.html
To simulate the problem, just enter or change the "first" textbox and
either click or tab to another control., it is tied to the onchange
event. An alert box that simulates the "warning". When you close it the
focus will not move back to "first" except in Opera. IE nor geckos will
return the focus. Oddly, I also call 'select()' on the element and
geckos do fully select content in "first" but the cursor will be
wherever you tabbed or clicked to...
I have found a "fix" shown on the "second" textbox by adding a 1ms delay
to the focus. Not quite elegant. I assume it's an event bubble thing,
this used to work in <=v4 browsers.
with trying to return focus to the field with an error. I have setup a
demo page.
http://www.littleworksstudio.com/temp/usenet/focus.html
To simulate the problem, just enter or change the "first" textbox and
either click or tab to another control., it is tied to the onchange
event. An alert box that simulates the "warning". When you close it the
focus will not move back to "first" except in Opera. IE nor geckos will
return the focus. Oddly, I also call 'select()' on the element and
geckos do fully select content in "first" but the cursor will be
wherever you tabbed or clicked to...
I have found a "fix" shown on the "second" textbox by adding a 1ms delay
to the focus. Not quite elegant. I assume it's an event bubble thing,
this used to work in <=v4 browsers.