Javascript bug on onblur event

Discussion of bugs in Mozilla Firefox
Locked
girishsk
Posts: 2
Joined: November 4th, 2004, 1:44 am
Location: Banglore
Contact:

Javascript bug on onblur event

Post by girishsk »

The javascript onblur does not work properly.Javascript written for on blur event and the next event that caused onblur are executing simultaneously.....It is not supposed to happen.It seems there is problem in handling events....

example code:

<html>
<body>

<script language="javascript">
function test(){
alert("ok");
}
</script>
<input type="text" name="test" onblur=javascript:test()>

<a href="http://www.girishsk.co.nr">Test</a>
</body>
</html>

onblur event and a href event occur simultaneously .....It is not supposed to happen
User avatar
fyo
Posts: 530
Joined: February 17th, 2004, 5:09 pm

Post by fyo »

Why not?

When you click the link after having focused on the input, you are removing focus from the inout - i.e. blurring it, so the event should trigger.

I don't know what spec would cover this type of thing, but it *seems* reasonable to be.

-fyo
--------------------
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/2007022001 Firefox/2.0.0.2
girishsk
Posts: 2
Joined: November 4th, 2004, 1:44 am
Location: Banglore
Contact:

Two action should not occur simultaneously

Post by girishsk »

Not actually
when you click on the href the event onblur has to occur first and it has to wait till the onblur event function is handled .......... I will give an example
Suppose if i am checking for the value in the text box on onblur and if submitting the form has resulted in the onblur event, submitting the form is done... without giving user an option to change what he/she has entered.
User avatar
fyo
Posts: 530
Joined: February 17th, 2004, 5:09 pm

Post by fyo »

I see your point about using it for such functionality (but why not use onChange or some such?), but there has to be a specification on this... so the real question is what does the spec say?

In IE, when I type something in the form field and then click the link, the a href NEVER fires. But I just clicked the link! That's counterintuitive to me.

Sounds like you are trying to accomplish something using a very inappropriate method. Depending on your exact needs, it would seem that onchange, onsubmit etc. would be better suited.

-fyo
--------------------
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/2007022001 Firefox/2.0.0.2
imranbagwan.cs
Posts: 3
Joined: January 3rd, 2018, 4:17 am

Re: Javascript bug on onblur event

Post by imranbagwan.cs »

I am facing similar issues, and there is difference between onblur and onchange.

So i have to use onblur.

the issue is with Mozilla ESR version, and not With regular Mozilla.
User avatar
LIMPET235
Moderator
Posts: 39952
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Re: Javascript bug on onblur event

Post by LIMPET235 »

Hi,
Please....check the date before posting.
This thread died on Sat 6th Nov 2004 01:32:20 am.

Locking due to very old age.
[Ancient Amateur Astronomer.]
Win-10-H/64 bit/500G SSD/16 Gig Ram/450Watt PSU/350WattUPS/Firefox-115.0.2/T-bird-115.3.2./SnagIt-v10.0.1/MWP-7.12.125.

(Always choose the "Custom" Install.)
Locked