Closed
Bug 337665
Opened 20 years ago
Closed 20 years ago
Input fields value is NOT accesible to JavaScript on blur event
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mrwarper, Unassigned)
Details
Attachments
(1 file)
|
1.52 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (OS/2; U; Warp 4.5; es-ES; rv:1.7.12) Gecko/20050922
Build Identifier: FireFox 1.5.0.3 for Win32 / FireFox 1.5.0.2, SeaMonkey 1.0.1 and Mozilla 1.7.12 for OS/2
While developing a JavaScript application I discovered that input field (<input type="text" ... />) values are not accesible for my script functions when the onblur event is triggered, but rather they always get the initial value of those fields.
I tested it in several Mozilla products and they all behave the same. Internet Explorer behaves as I expected and reports the current value. I do my javascript development primarily in Mozilla so this came as a complete surprise to me.
I've made a simple testcase, I'll attach it somewhere over here.
Reproducible: Always
Steps to Reproduce:
1. Download my testcase file and load it into a Mozilla product.
2. Edit any text field and switch focus somewhere else (just hit tab or whatever).
Actual Results:
3. See the alert dialog box (wrongly) report the initial value for the input field.
Expected Results:
4. Repeat the above steps in Internet Explorer and see everything work OK: the alert dialog box reports the current value for the input field.
| Reporter | ||
Comment 1•20 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
This bug seems to be present in SeaMoney and Mozilla, and not only in FireFox. A better way to specify this should be provided somehow in Bugzilla (multiple product selection allowed when choosing the product affected by the bug?).
Severity: normal → major
Comment 3•20 years ago
|
||
You're getting the attribute, which is what was specified in the original HTML markup. In this case, there is no "value" attribute on the elements, so you're getting "null". IE's has a bug in that it maps attributes to properties directly in cases like these, which is against the DOM spec. To get the desired behavior, use element.value instead of element.getAttribute("value"). See also bug 283164
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 4•20 years ago
|
||
Hello,
(In reply to comment #3)
> You're getting the attribute, which is what was specified in the original HTML
> markup. In this case, there is no "value" attribute on the elements, so you're
You're right. For some odd reason (three days without sleep? ;) I was trying to get the value as an attribute, instead through .value. Mh.
> getting "null". IE's has a bug in that it maps attributes to properties
> directly in cases like these, which is against the DOM spec. To get the desired
> behavior, use element.value instead of element.getAttribute("value"). See also
> bug 283164
And I even made a testcase. Sorry and thanks for your time!
Severity: major → minor
You need to log in
before you can comment on or make changes to this bug.
Description
•