Closed Bug 26188 Opened 25 years ago Closed 25 years ago

onkeypress= fires before value of html:input has been updated

Categories

(Core :: XUL, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: hangas, Assigned: saari)

Details

The onkeypress= handler for an html:input type="text" fires before the value of that element has been updated. On Mac when the JS handler retrieves the value it contains the value of the field including the key that was pressed, but on PC it contains the value of the field before the key was pressed. This means that we are failing to provide the correct behavior in some of our dialogs on PC.
reassigning to saari, who says that Ender may be hooking this handler, so the order the handlers are called could be the difference.
Assignee: trudelle → saari
On Mac 4.6 we retrieve the value before the key is entered into the field. Here is a simple test case: <html> <body> <form name="me"> <input name="you" type="text" onkeypress="window.document.me.them.value = window.document.me.you.value;"><BR> <input name="them" type="text" > </form> </body> </html>
On Mozilla linux and win32, the handler fires before the key is in the value. Looks like Mac is the deviant, although I have not confirmed that yet
I really hope that this is supposed to give me a value that includes the key. Otherwise I do not have a good way to create the display name as the user types the first and last name.
Unfortunately, it looks like it is supposed to fire before the new key is in the value. I've even tried this on that other browser from Redmond. Can you get the value of the current key event and concatenate it to the value you get from the field?
Paul, I just tested this on last night's mac build, and it behaves like the others; you don't get the current key from the value in the onkeypress handler. What do you want to do with thi?
Not sure what to do then. I thought there would be a way to do this feature. I guess the feature is going to be broken unless we use onkeyup which looks really bad but will be better than not working at all. Concatenating the character only works if you know where the cursor is, if something is selected, if you are in a two byte entry system, etc. Need to have a feature that gives me the ability to grab the value of the input field as soon as it has changed on the screen. onkeypress= fires after the value has changed on the screen but before the value is in value. This boggles the mind.
oninput is the event handler you want.
Okay, closing this bug as invalid as the current behavior seems to be the correct one
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Sorry for the spam, changing QA contact.
QA Contact: paulmac → jrgm
Works for Me Platform: PC OS: Windows 98 Build # 2000100508 M18 Trunk Build Marking as Verified
Status: RESOLVED → VERIFIED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.