Closed Bug 50418 Opened 19 years ago Closed 18 years ago

textfield/textarea value attribute doesn't work before appendChild()


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






(Reporter: taras.tielkes, Assigned: jst)



(Keywords: dom1, testcase, Whiteboard: [nsbeta3-])


(2 files)

Programmaticaly creating a textfield and modifying the "value" property seems 
to have no effect.

PDT: this is very basic DOM0/DOM1 code.
Keywords: nsbeta3, testcase
With a 24 aug nightly build, the textfield remains empty. Expected bahviour: the
textfield gets the value assigned to it. This is wat happens when you run the
textcase in IE5 on Windows.
Also seen on Aug 25 nightly build on Linux, changing to All/All
OS: Windows NT → All
Hardware: PC → All
It seems "value" of textfields (and perhaps more form elements) only works when
the form control is already connected to the DOM. (that is, inserted, appended,
et cetera).
Marking nsbeta3- and futuring.
Whiteboard: [nsbeta3-]
Target Milestone: --- → Future
ay, this is a show stopper for me, fix it asap pretty please! i'll hook you up
with some hot scandinavian blondes.

A lot of HTML objects had similar errors back in the M15 days. I'll check some 
more HTML form controls and see if they have this issue.
At the moment, the "value" property of a HTML form control will only be visible 
when the "value" assignment takes place *after* attaching to the document.
(Using appendNode() or a similar method).

Setting the "defaultValue" property, and after that attaching the textfield to 
the document will render the textfield with the "defaultValue" as contents.

I think that the first should work, and the second should display a empty 
textfield that will only get the "defaultValue" when you RESET the form.(This 
is the behaviour of IE5, and as-far-as-I-see what the spec says.) CC'ing Vidur 
to comment on this. Vidur, the IE5 behaviour is in accordance with what you 
wrote in the dom news group.(6/22/2000, "DOM and text INPUT" thread.)
Attached file Simplified testcase
Summary: Textfield.value is doesn't work → textfield/textarea value attribute doesn't work before appendChild()
Argh! The current mozilla and IE5 implementations of this are 180 degrees apart.
(Check the 2nd testcase in both browsers).

The questions I have are:
1) Is it OK to use the "value" attribute *before* the element is part of a 

2) If I set the "defaultValue" before doing appendNode(), should the control 
show up with that value when I insert in into the document? (I think yes, but 
IE5 ignores this)
Mass update of qa contact
QA Contact: gerardok → janc
This does still not work on the latests Mozilla builds or on PR3. Its a big 
showstopper for me...any chance it will be fixed?
Adding Pollmann and myself to CC. I have a feeling this is either invalid
(because of bug 27327), or caused by bug 17003 (html text chunks don't have a node).
See also comments in bug 57269, some of which could be relevant...
Keywords: dom1
Component: DOM Level 1 → DOM Core
QA contact Update
QA Contact: janc → desale
Nominating for 092.
Keywords: mozilla0.9.2
Updating QA contact to Shivakiran Tummala.
QA Contact: desale → stummala
this should be fixed with my patch in bug 17003
Depends on: 17003
this one is fixed with the fix for bug 17003. where/how can I get those Scandinavian blonds? I live in 
Stockholm so it would be great if you could get hold of any in this 
neighborhood. But traveling to Norway is totally ok. See also my comments in 
bug 95849.
Closed: 18 years ago
Resolution: --- → FIXED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.