PDA

View Full Version : How to dynamically add fields in a form?



buzhisihuo
10 Dec 2007, 6:46 AM
I writed code like this:


Example={
init:function(){
var myForm = new Ext.form.Form({});
myForm.add(new Ext.form.TextField({
fieldLabel: 'Attr1',
name: 'attr1',
width:175,
allowBlank:false
}));
myForm.addButton({text:'add'},
function(){
myForm.add(new Ext.form.TextField({
fieldLabel: 'Attr2',
name: 'attr2',
width:175,
allowBlank:false
}));
}
);
myForm.render('form-ct');
}
}
Ext.onReady(Example.init,Example);

after run,i can see items of form have changed from firebug, but it is invisible on firefox. i want to know how to refresh form and let the textfield my added visible. thanks!

justCharlie
10 Dec 2007, 1:59 PM
Have you tried calling the getUpdateManger() then calling the refresh() function?