Reputation: 8425
Dynamically add text box in a specific fieldset here field set is Extra , as i have many fieldset in the form so here i am sharing the code of only one fieldsest.
for example,
var extraData = [{
bodyStyle: 'padding-left:5px;',
items:{
xtype:'fieldset',
title: 'Extra',
collapsible: true,
autoHeight:true,
layout:'column',
items:[{
columnWidth:.5,
layout: 'form',
items: [{
xtype:'textfield',
fieldLabel: 'Comment',
name: 'comment',
anchor:'95%'
}]
},{
columnWidth:.5,
layout: 'form',
items: [{
xtype: 'fileuploadfield',
fieldLabel: 'Photo',
name: 'last',
anchor:'95%'
}]
}]
}
}];
var fsf = new Ext.FormPanel({
labelWidth: 75, // label settings here cascade unless overridden
url:'save-form.php',
frame:true,
title: 'Enter New Groom Record',
msgTarget: 'side',
width: 650,
items:extraData
});
Upvotes: 4
Views: 4837
Reputation: 6760
Give id to the fieldset and the form.
Then do,
Ext.getCmp('myfieldset-id').add(my_dynamic_new_component);
Ext.getCmp('myform-id').doLayout();
Upvotes: 4