Closed
Bug 65609
Opened 24 years ago
Closed 24 years ago
[DOM] form elements inside of append subtrees aren't added to form
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: chris, Assigned: pollmann)
References
Details
(Keywords: dom1, testcase, Whiteboard: fix in hand)
Attachments
(3 files)
2.23 KB,
text/html
|
Details | |
539 bytes,
patch
|
Details | Diff | Splinter Review | |
56.90 KB,
patch
|
Details | Diff | Splinter Review |
Adding form elements to an HTML page on the fly using Javascript
DOM methods produces a change in the page layout, but no change in the form
behavior. I.e., given an input element created as follows --
var in = document.createElement("select") ;
in.setAttribute("name", "input1") ;
// more initialization...
some_node.appendChild(in) ;
-- the element data does not appear as the result of a form
submission -- there is no parameter 'input1' available in the HTTP
request.
Mozilla 0.7/Win
Comment 1•24 years ago
|
||
I think this is the same as bug 59533. However bug 59533 is only about text
inputs, so this is more general. Since jst assigned it to Eric Pollman, i'm
assigning this one to him too.
Assignee: jst → pollmann
Comment 2•24 years ago
|
||
Reporter do you have a testcase we use to verify this?
I've uploaded a test case. Creating it gave me some more insight into the bug.
Input elements DO appear in the posted form if they are appended directly to the
form element or one of its children. They do not appear if they are appended to
a new element that is subsequently appended to the form.
This works:
theForm.appendChild(new_input) ;
And this works:
var new_p = document.createElement('p') ;
form_child.appendChild(new_p) ;
new_p.appendChild(new_input) ;
However, this does not work:
var new_p = document.createElement('p') ;
new_p.appendChild(new_input) ;
form_child.appendChild(new_p) ;
Both ways work in IE.
Comment 5•24 years ago
|
||
Confirmed
Platform: PC
OS: Linux 2.2.16
Mozilla Build: 2001011704
Marking NEW.
Updated•24 years ago
|
Component: DOM Level 1 → DOM HTML
Comment 7•24 years ago
|
||
Assignee | ||
Comment 8•24 years ago
|
||
Thanks Fabian, this is indeed a dup!
*** This bug has been marked as a duplicate of 63954 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Comment 9•24 years ago
|
||
Insofar as this bug may be a duplicate of bug 63954, that bug lacks the detail
provided above, specifically:
The form elements do not appear in the posted form ONLY when they are
"indirectly" appended to the form element, i.e., when they are appended to an
element that is then appended to the form. Any element appended directly to the
form WILL appear in the post.
Assignee | ||
Comment 10•24 years ago
|
||
Oops, not really a dup - the other bug was a WFM, but this one really exists.
The problem is that when we add a form control to the content model, we search
for the form that contains it, which works in the second test case because we
are appending the control to a full document. In the first case, however, when
we append the select, it searches for a containing form and doesn't find one,
then later when the subtree is added to the document, no search for a containing
form is performed.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Summary: [DOM] dynamically-created input elements aren't submitted → [DOM] form elements inside of append subtrees aren't added to form
Assignee | ||
Updated•24 years ago
|
Status: REOPENED → ASSIGNED
OS: Windows NT → All
Hardware: PC → All
Target Milestone: --- → mozilla0.9.1
Assignee | ||
Comment 11•24 years ago
|
||
*** Bug 59533 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 12•24 years ago
|
||
Assignee | ||
Comment 13•24 years ago
|
||
Turns out the search for a form parent *was* being performed in SetDocument, but
that was actually before the <td> was added to the content model (er, had it's
parent set). This patch sets the <td>'s parent so that FindFormParent can
continue walking up the chain of content and locate the enclosing form.
Updated•24 years ago
|
Comment 15•24 years ago
|
||
With the patch uploaded, isn't it time to mark this resolved?
Comment 16•24 years ago
|
||
Nope, it needs to be reviewed and checked-in before marking it fixed.
Comment 17•24 years ago
|
||
With a comment added in the source explainging why the SetParent() call is
needed I'll say sr=jst. Eric, given that you have a fix for this, could you land
this ASAP to give it as much milage as possible before the beta?
Assignee | ||
Comment 18•24 years ago
|
||
Sure thing (oops, forgot about this little bug...)
Target Milestone: mozilla0.9.1 → mozilla0.9
Assignee | ||
Comment 19•24 years ago
|
||
jst, when you get all rested up from the xpconnect dom conversion, I think I'll
need to bounce some questions off of you about this (before checking it in). I
was trying to explain the change to Nisheeth for review today and I realized
that I don't fully understand all the implications. :) (Reviews are good, eh?)
Assignee | ||
Comment 20•24 years ago
|
||
Assignee | ||
Updated•24 years ago
|
Whiteboard: fix in hand
Comment 21•24 years ago
|
||
Remove the unrelated changes in nsHTMLContentSink and nsXMLContentSink
(scrollbar related) and I'm ok with this change, sr=jst, nice little one liner
turned into a quite large (but good) change :-)
Assignee | ||
Comment 22•24 years ago
|
||
Fix checked in.
To verify:
view the first attachment "Demonstration of bug"
click on the button labeled Pre-append to TD (a new dropdown should appear)
click on the button right below that labeled Post Form
Expected result:
URL bar should read:
http://bugzilla.mozilla.org/post-tester.jsp?select_box0=1&preTD0=1
Before fix it would read:
http://bugzilla.mozilla.org/post-tester.jsp?select_box0=1
Thanks!
Status: ASSIGNED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•