Text input onchange event does not fire correctly after hitting enter

RESOLVED WORKSFORME

Status

()

Core
Layout: Form Controls
--
minor
RESOLVED WORKSFORME
15 years ago
7 years ago

People

(Reporter: zack-weg, Unassigned)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

150 bytes, text/html
Details
(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030730
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030730

If the onchange event fires in a <input type=text> because the user hits enter,
the value for detecting a subsequent onchange event seems not to be updated.
This causes onchange events when actually nothing has changed and onchange won't
fire after restoring the old value.


Reproducible: Always

Steps to Reproduce:
1. Load the testcase to be attached.
2. Type something into the first text field.
3. Hit enter.
   -> The onchange handler will fire and append a '*' to both text fields.
   This is expected behavior.
4. Hit enter again.
   -> The onchange handler will fire again and append a '*' to both text fields.
   This is unexpected, since nothing has changed.
5. Delete the last asterisk and hit enter again.
   -> Nothing happens.
   This is unexpected, since the value has changed.
6. Change the value of the text field to something new.
7. Hit enter.
   -> The onchange handler will fire and append a '*' to both text fields.
   This is expected behavior.
8. Put focus somewhere else by tabbing out of the text field or by clicking
   somewhere else.
   -> The onchange handler will fire again and append a '*' to both text fields.
   This is unexpected, since nothing has changed.




Note: The second text field is just to monitor onchange and onsubmit events.
Onsubmit events will append a '+', but they currently do not happen if the form
has more than one text field and no submit button. But they will happen, if the
second text field is a separate form. Otherwise, behavior is the same with a
single text field.
(Reporter)

Comment 1

15 years ago
Created attachment 128927 [details]
testcase
Is there a problem with just calling:

GetTest(&mFocusedValue);

in nsTextControlFrame::CheckFireOnChange after firing the onchange?  I supposed
that could screw up if the event destroys the frame....

Over to the right component, in any case
Assignee: saari → form
Status: UNCONFIRMED → NEW
Component: Event Handling → Layout: Form Controls
Ever confirmed: true

Comment 3

14 years ago
On WinXP (build 20040113): if I hit ENTER on the first input[type=text] (on the
testcase), a '*' is added. So the OnChange event is being triggered. The event
that is not being triggered is the "OnSubmit" (if I am right, I think the
summary must change).

Besides, this problem is solved when a submit button is added to the testcase.
Assignee: layout.form-controls → nobody
QA Contact: ian → layout.form-controls
This is working with 3.6.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.