View Full Version : Destroy form element before render

14 Jun 2007, 7:46 AM
I have a bunch of forms I create that have common elements. Because of this I use functions to create specific fieldsets in the form so its easy to evaluate a couple of variables and spit out the correct form. This is all done before the initial render.

What I'm running into is on a couple of the forms I need most of the elements created by the function, but not all. How can I destroy the elements created by the function before the form is rendered? I've tried elementName.destroy(); but this doesn't work if the element hasn't been rendered yet. It works fine after, but I get a flicker.

14 Jun 2007, 8:03 AM
You could try to remove from the form.items collection before render. Or, you could try adding a fieldClass:'display:none' to those fields - could be an issue if you when you submit and they haven't had a value set.