Closed
Bug 405851
Opened 18 years ago
Closed 15 years ago
onBlur event doesn't work properly or as it probably should work.
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: cmdrwillriker, Unassigned)
Details
(Keywords: js1.5, Whiteboard: [CLOSEME 2010-07-30])
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10
In a validation function on a input text in the onBlur event, wich returns false, as example, it shouldn't be allowed to the focus be set to the next field, but keep it in the field where the event occured.
I'm not quite sure if the implementation of JavaScript language on FireFox is "by-the-book" as recommended by W3C, or if the implementation of JS on IE is the correct one, because in that browser, it works just fine.
As example, the following code won't work on FF, but it will works on IE:
<html>
<head>
<title>onBlur</title>
<script language="Javascript">
function checkSize( field ) {
if( field.value.length < 6 ) {
alert('*** Password must have 6 characters minimum.');
field.focus(); //keep the focus on this field if it wrong.
return ( false ); // it must kill the onBlur event
}
}
</script>
</head>
<body>
<form name="f1" method="get">
<h3>Login Form</h3><hr>
User:<br>
<input type="text" name="user"><br>
Password:<br>
<input type="password" name="passw" maxlength="10" onBlur="checkSize( this );">
<input type="submit" name="send" value="Login">
</form>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
1.Create a HTML simple code such as described above.
2.Open the page with FF and test it.
3.Open the page with IE and test it.
Actual Results:
The code works fine on IE but it doesn't on FF.
Expected Results:
In the same way that is possible to prevent a form for being submited, using the onSubmit event with some function that returns false, I suppose that the same logic it should be applied to the onBlur event.
As I said, I'm not sure wich implementation of JavaScript is recommended by W3C, so, the behaviour of onBlur event on FF must be right, despite I think that it aren't.
Comment 1•15 years ago
|
||
This bug was originally reported on Firefox 2.x or older, which is no longer supported and will not be receiving any more updates. I strongly suggest that you update to Firefox 3.6.6 or later, update your plugins (flash, adobe, etc.), and retest in a new profile. If you still see the issue with the updated Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME
http://www.mozilla.com
http://support.mozilla.com/kb/Managing+profiles
http://support.mozilla.com/kb/Safe+mode
Whiteboard: [CLOSEME 2010-07-30]
Version: unspecified → 2.0 Branch
Comment 2•15 years ago
|
||
No reply, INCOMPLETE. Please retest with Firefox 3.6.8 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
Reporter | ||
Comment 3•15 years ago
|
||
I have made a test on FF 3.6.10, using the same code previously presented and the results were the following:
The onBlur called the checkSize function and it displayed the alert message. However, despite the message has been showed and the form hasn't been submitted, the focus moved to the submit button, wich, when is pressed a second time, submit the form, wich is not the expected result for this event.
As expected, the code worked right on IE. It showed the message and killed the onBlur event, preventing it from moving to the next object, keeping the focus in the object where the event occured, until the condition in the called function (i.e. checSize) is different from "false".
Reporter | ||
Comment 4•14 years ago
|
||
Similar behavior related to this code above can be observed on FF 4.0b10.
You need to log in
before you can comment on or make changes to this bug.
Description
•