Data validation and Event Order problem (onblur fires before onchange)

RESOLVED DUPLICATE of bug 65581

Status

()

Core
DOM: Events
RESOLVED DUPLICATE of bug 65581
13 years ago
8 years ago

People

(Reporter: Deepak P Joshi, Unassigned)

Tracking

({testcase})

Trunk
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040219
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040219

When a text field fails validation we want to keep the focus on that field so
attempt to set the focus back onto that field. That is when we fillup the
"ERROR"(validation failure case)in the first field and press a tab, the focus
has to come back to the first field. But on pressing the tab the focus moves to
the next field.
   On normal behaviour of the browser when we press a tab, the onChange event
has to fire first than onBlur. But till mozilla latest open source release on
windows and OS/2 onBlur is firing first and onChange is firing late.

Reproducible: Always
Steps to Reproduce:
1.Run the browser
2.Opern a local html testcase
3.Fill "ERROR" in the first field of the text box.
4.Then press a tab, the focus is moves to next field(instead, whan the text
field fails validation, the focus has to stay in the first field)
5.See Event firing in the logging text box below, the onBlur event is firing
first than the onChange event. 
   
Actual Results:  
1. After filling up "ERROR"(validation failure case) in the first field and
press tab, simply the focus is moving to the next field.
2. In logging text box below, onBlur is firing first than onChange event. 

Expected Results:  
1. After filling up "ERROR"(validation failure case) in the first field and
press tab, the focus has to come back and stay in the first field.
2. In logging text box below, onChange event has to fire first then onBlur evnet
has to fire. 

From our test analysis, problem seen on mozilla latest open source release on
both windows and OS/2.
But on netscape4.61 and IE the problem is not seen. That is when validation
fails the focus is coming back and staying in the first field. From logging text
box, we 
can see onChange event is firing first and then onBlur is firing.
(Reporter)

Comment 1

13 years ago
Created attachment 148659 [details]
testcase
> On normal behaviour of the browser when we press a tab, the onChange event
> has to fire first than onBlur.

That's what I see in NS4 and Opera.  Not in Mozilla or Konqueror.

Over to events to see whether we can fix this up, but since the onblur is what
fires the onchange, as I recall....
Assignee: general → events
Component: Browser-General → DOM: Events
QA Contact: general → ian
Summary: Data validation and Event Order problem → Data validation and Event Order problem (onblur fires before onchange)

Comment 3

13 years ago
Is there any way to know what the "correct" behavior is?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Using Testcase #4 in bug 231830. The following UAs do 'onchange' before 'onblur':
IE6/XP, IE7b2/XP, all four combinations of Opera8/Opera9 on XP/Linux,
Safari(nightly)/OSX 10.4.6.
Assignee: events → nobody
QA Contact: ian → events
The change/blur event order was fixed by bug 357684.
Keywords: testcase
The remaining problem that the focus() calls are ignored is bug 65581.
Note that you can workaround that problem using setTimeout:
setTimeout(function(){document.gapform.Field1.focus();},0);
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 65581
You need to log in before you can comment on or make changes to this bug.