"David BERCOT" <da**********@wanadoo.frwrites:
Lasse Reichstein Nielsen wrote:
>"Rik" <lu************@hotmail.comwrites:
onblur="this.focus()"
....[don't]...
Of course, I should not use this like that. It would be in a function
with a test...
Still, it's not good user interface design to prevent the user from
doing what he wants to do.
It's much better, safer, and coincidentally also easier to implement,
to mark an erroneous field as such and just prevent submission, than
it is to prevent navigation.
Let people write garbage if that is what they want. Just tell them
that it's garbage and (attemp) to stop them submitting it (but check
on the server anyway).
But, before this test, I don't understand why this function does not
work in Firefox !!!
It's a matter of timing. When you try to leave an input control,
the browser fires a number of events - onblur, onchange and onfocus
(on the new control). It happens in roughly that order (at least
in Firefox).
It corresponds to the browser first removing focus from one control
and then setting it on another. In some browsers, setting the focus
back in on of the first two event handlers will work, in Firefox,
the setting of the focus to the other control will still happen
afterwards.
What you could do was have a check when you leave a field, that sets
stores the erroneous field somewhere, and then, onfocus in the other
controls, see if there is an erroneous control and set focus back.
But still, it's bad design!
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'