Closed Bug 363359 Opened 18 years ago Closed 18 years ago

OnChange event doesn't catch browser's Auto complete cahnge value

Categories

(Firefox :: Address Bar, defect)

2.0 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 359387

People

(Reporter: gal.ga75, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Iceweasel/2.0 (Debian-2.0+dfsg-1)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Iceweasel/2.0 (Debian-2.0+dfsg-1)

Bug description:
================
When using the browser's Auto Complete function, setting one of the suggested values and losing focus, the browser doesn't catch the OnChange event.
This worked fine in Firefox versions < 2.0 before.

Where you can see the problem:
====================================
I have this simple HTML page at: http://gurarie.org/x1.html

This page has a text filed which has OnChange attibute which supposed to popup JavaSCript alert when the value of the text field has changed.

The page HTML is:
----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">

<head>
        <title>test</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
<div>
<form action="x1.html" method="get">
        <p>
                <input type="text" name="txt" value="" size="25" onchange="alert(this.value);" />
        </p>
        <p>
                <input type="button" name="a" value="test" />
                &nbsp;
                <input type="submit" name="submit" value="Submit" />
        </p>
</form>
</div>

</body>
</html>

Reproducible: Always

Steps to Reproduce:
1). Goto: http://gurarie.org/x1.html
2). Set the value dddd in the text filed and click the submit button.
3). A JavaScript alert will be shown with the value "dddd", click OK and then click submit again (without changing the value).
4). You will be redirected again to this page, double click on the text filed and use the browser auto complete to show dddd, select it and click the "test" button.

Actual Results:  
Nothing happens

Expected Results:  
The browser should display JavaScript alert dialog with the "dddd" value that was selected from the borwser's auto complete box.
Version: unspecified → 2.0 Branch
I also see this behavior in Firefox 2.0. I don't see this behavior in Firefox 1.5.0.8 or Flock 0.7.8 (based on Gecko Gecko/20061109).

Interseting to note that in the above usage, if one types something into the form,  triggers onchange, then going back to the field - clears the field and triggers auto-compelte, then causing the field to lose focus will not trigger onchange.

I think that auto-complete overwrites some flag or buffer used to calculate onchange, in addition to writing to the field - and this behavior is new to the Firefox 2.0 implementation of Gecko.
I get a similar bug when trying to read the content of an input-element after autocompletion:

var check = document.nameofform.nameofelement.value;

The return value is empty although it is shown correctly. After inserting something into another input-element the value is correct. Very confusing behavior.

I also think this is new in Firefox 2.0 because i cannot reproduce the error somewhere else.
I have the same bug.
I want to activate a "save-button" if something changes in the form.
If you select a value in the auto-complete list no onchange event triggered.

Firefox 2.0.0.1/Windows XP SP2.
Duplicate of Bug 359387?
Indeed. It would be best to close this ticket as duplicate and focus the efforts on the older bug.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.