Closed Bug 35463 Opened 24 years ago Closed 24 years ago

<INPUT ONCHANGE not reflected into js

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED DUPLICATE of bug 49120
Future

People

(Reporter: martin.honnen, Assigned: jst)

Details

Attachments

(1 file)

It seems that the onchange handler of an INPUT TYPE="text" element is not 
reflected into js:

<FORM NAME="aForm">
<INPUT TYPE="text" NAME="aField"
       ONCHANGE="this.value = this.value.toUpperCase();"
>
<INPUT TYPE="button" VALUE="show onchange"
       ONCLICK="alert(this.form.aField.onchange)"
>
<INPUT TYPE="button"
       VALUE="call onchange"
       ONCLICK="this.form.aField.value = 'kibology';
                this.form.aField.onchange()"
>
</FORM>
The onchange handler is indeed called for me, but there's a reflow/repaint bug
in mozilla so the modified value doesn't show up when you type in the input but
if you resize the window or do something else that causes a reflow/repaint
the updated value is shown. Marking WORKSFORME, please open a separate bug on
the repaint problem.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
I am not sure I made it clear what the bug is. The onchange IS fired when you 
blur the field BUT it is not available as a (function) property of the INPUT 
field; 
  alert(this.form.aField.onchange)
shows undefined and
  this.form.aField.onchange()
gives an error that onchange is not a function (which it should).
I just checked the demo page with the latest M15 build and still pressing the
first button shows undefined where it should show the function definition and
pressing the second button yields a js error where it should execute the
onchange handler.
Therefore I reopen the bug.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Actually, Martin, I have noticed that Mozilla does not preserve ANY HTML-
defined event handlers.  In MSIE, they would be turned into anonymous functions 
and set as a property of their element, but Mozilla does not do this.  The 
title of this bug should be changed to read:

"HTML-defined events not accessible as function object properties"
This bug has been marked "future" because the original netscape engineer

workingon this is over-burdened. If you feel this is an error, that you or

another known resource will be working on this bug,or if it blocks your work in

some way -- please attach your concern to the bug for reconsideration.
Target Milestone: --- → Future
hi,

did you notice that on any HTMLInput object this.form is undefined whereas it
should reference the FORM the input belongs to ?
oops, forget about my previous comment. i tested it on another machine and it
worked. the first machine must have something wrong with its installation of Moz.

sorry for the spam.

*** This bug has been marked as a duplicate of 49120 ***
Status: REOPENED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → DUPLICATE
Verified Duplicate.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.