View Full Version : Add config option to Form during creation

11 Feb 2016, 8:14 AM
I have a form with a few text fields already defined. When creating the form i want to be able to pass in another item option to create a hiddenfield. The code below doesn't seem to work. Is this possible?

Ext.create('msc.view.form.PricingException', {
quote_id: grid.quote_id,
xtype: 'hiddenfield',
name: 'type',
value: 1

Form file:

Ext.define('msc.view.form.PricingException', {
extend: 'Ext.form.Panel',
alias: 'widget.pricingexceptionform',

initComponent: function(){
Ext.apply(this, {
quote_id: this.quote_id,
co_id: this.co_id,
itemId: 'price_exception_form',
url: '',
waitMsg: 'Saving Exception, please wait...',
standardSubmit: false,
border: false,
layout: 'vbox',
bodyPadding: '10',
fieldDefaults: {
labelAlign: 'top',
msgTarget: 'side',
allowBlank: false
defaults: {
border: false,
layout: 'anchor'
items: [{
xtype: 'textareafield',
fieldLabel: 'Description',
name: 'descrption',
anchor: '-20',
maxLength: 255,
enforceMaxLength: true,
allowBlank: false
xtype: 'numberfield',
fieldLabel: 'Amount',
name: 'amount',
allowExponential: false,
emptyText: '0',
allowBlank: false
xtype: 'hiddenfield',
name: 'status',
value: 1
buttons: {
items: [{
text: 'Save',
action: 'execption_save'


Gary Schlosberg
11 Feb 2016, 9:32 AM
I'm not sure it can work that way. Can you add the field after instantiating the form?

Here's a related discussion that might help: