PDA

View Full Version : Nested "<form..." breaks Ext on FF



atchijov
19 Aug 2009, 10:55 AM
I am not sure if this should be called a bug. Probably luck of error checking.

If by any chance you end-up trying to have FormPanel as a descendant of another FormPanel the whole thing will break rather ungracefully on FF (works on Safari, have not tested on IE).

Root cause of all troubles is in DomHelper.overwrite method.


...
overwrite : function(el, o, returnElement){
el = Ext.getDom(el);
el.innerHTML = createHtml(o);
return returnElement ? Ext.get(el.firstChild) : el.firstChild;
},
...

if one of el ancestors is <form> tag and o defines another <form> tag (nested), then el.innerHTML will not be set to result of createHtml(o) and el.firstChild will be null

I do realize that it is bad idea to have nested forms, but at the same time I feel that Ext can handle this situation little bit more gracefully. Basically, the fact that createHtml(o) produced valid HTML snippet, does not guaranty that el.firstChild is not null.

Andrei

Animal
19 Aug 2009, 10:56 AM
That's not valid HTML anywhere.

What would a form in a form do?

atchijov
19 Aug 2009, 11:17 AM
I am not saying that it is valid HTML. In my case I was building complicated GUI from many components and end-up with nested forms. End result was quite dramatic failure to render my GUI.

What I am saying is that you can not be sure that if you assign valid HTML snippet to "innerHTML", you will have this snippet "accepted". And also that it could save me quite a few hours if Ext check for this kind of problems and report it in one way or another.

19 Aug 2009, 11:31 AM
forms cannot contain forms - period!