PDA

View Full Version : Forms and IE compatibility



cyChop
28 Jun 2012, 6:39 AM
Hello there! Long time, no see! And as usual, I only come with a matter in hand. How rude of me!

To cut it short, we had problems to make our application work in IE8. I came accross this post which seems to describe exactly our problem: http://www.sencha.com/forum/showthread.php?1743-Invalid-source-HTML-for-this-operation-Error-In-IE

From what I gathered, it is impossible to add forms (FormPanel) into forms and have it work inside IE (though it just looks great inside Chrome and FireFox). We do that in our application to have dynamic forms: to change fields according to a combo value, we remove the nested form and add a new one with appropriate fields.

So here I am: am I really doing distasteful things? If yes, what is the better way you could propose? If no, what should I change to make it work inside IE? Of course, I would be glad if you had a solution both respecting best-practices and allowing me to adapt with few work.

Thanks a lot!

GWT 2.1.1
GXT 2.1

sven
28 Jun 2012, 7:56 AM
The initial question i would have is why are you using a FormPanel? The only extra you gain from using a FormPanel is that you could do a normal http form submit. If you do not require that, you can archieve the same using a ContentPanel with a FormLayout.

When using ContentPanels, you would not run into the problem that you are nesting multiple form tags into each other.

cyChop
28 Jun 2012, 9:12 AM
From a layout point of view, this is totally right indeed, and though I did not think of it today, I have done this elsewhere in the application. In this particular case, I do use the submit method but this is more because it was available than because I needed it.

What I am really interested in here are the getFields() and clear() methods. However, reimplementing them would not be too much of a hassle to keep clear from IE's limitations. This is a lead I will investigate further.

As usual, you're reactive and good advice, sven! :)

sven
28 Jun 2012, 10:20 AM
You can almost copy and paste those methods. In GXT 3 we simple copied them into a helper class, so you can use them with any container.

cyChop
29 Jun 2012, 5:53 AM
Just a word to confirm that everything works fine by using ContentPanels. I created a Helper class just as you suggested but had to duplicate the FormButtonBinding to make it work with the new structure. Tanks a lot, sven!