Opened 13 years ago

Closed 13 years ago

#314 closed defect (invalid)

Form Elements Inside Dialog Widgets

Reported by: derek.lakin@… Owned by: anonymous
Priority: high Milestone:
Component: Widgets Version: 0.2
Keywords: dialog, widget, moveChildren, buildFromTemplate Cc:
Blocked By: Blocking:


If <form /> elements are inside the content of a Dialog widget then those <form /> elements are lost once the widget has been rendered.

The render process involves attaching the declared widget content to a new <div /> as a new child of the <body /> (i.e. at the bottom). To perform this task the dojo.dom.moveChildren method is called from the buildFromTemplate method. Within moveChildren the child nodes are removed from the original element and appended to the new element (using appendChild and firstChild). It seems that this process does not result in the closing </form> tag being rendered to the client, resulting in the missing form in the resulting dialog.

I have been able to work round the problem by changing the moveChildren method to simply doing a: destNode.innerHTML = srcNode.innerHTML; and dojo.dom.removeChildren(srcNode);, which does result in the correct content being rendered in the dialog.

It is unclear to me why it is necessary to perform the destructive moveChildren method in this case of relocating declared content to it's rendered location. In fact the, now empty, source node does in fact appear to be rendered in the dialog as well :S Perhaps it would be simpler (and possibly faster) to just append the source node to the attach point in the dialog template.

Attachments (1)

314-test_Dialog.html (12.0 KB) - added by derek.lakin@… 13 years ago.
test_Dialog page that shows the problem when the dialog widget is contained within a form.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 13 years ago by derek.lakin@…

I have managed to track this down to occuring when there is a <form /> element that contains the Dialog widget.

The attached file illustrates this problem.

Changed 13 years ago by derek.lakin@…

Attachment: 314-test_Dialog.html added

test_Dialog page that shows the problem when the dialog widget is contained within a form.

comment:2 Changed 13 years ago by dylan

Isn't this just a bigger problem with forms not being nestable in general? So are you asking us to workaround this limitation with the html forms rec.?

comment:3 Changed 13 years ago by bill

Resolution: invalid
Status: newclosed

sorry, you can't have a <form> inside another <form>. it's invalid html.

Note: See TracTickets for help on using tickets.