PDA

View Full Version : Adding label to a FormPanel



Kloon
25 Feb 2010, 6:22 AM
I am struggeling to add a Label to a FormPanel, if I use the code below it just shows as a textfield


{fieldLabel: 'Error Number:', name: 'Error Number', inputType: 'Label'}

Any help would be appreciated.

Animal
25 Feb 2010, 6:28 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.Container&member=defaultType

Kloon
25 Feb 2010, 6:35 AM
Okay I get why its giving met textfields, its because my default type is textfield, but isnt inputType: 'Label' suppose to overwrite the default?

Kloon
25 Feb 2010, 9:27 PM
So I tried various ways but still I can't seem to get this right.


var form = new Ext.FormPanel ({
bodyStyle:'padding:5px 5px 0',
defaultType: 'textfield',
width: 500,
frame: true,
items: [
{fieldLabel: 'Error Number:', name: '@Error_Number', inputType: 'label', text:'testing'},{fieldLabel: 'Date Occurred:', name: '@Date_Occurred', inputType: 'label', text:'testing'},{fieldLabel: 'Error Code:', name: '@Error_Code', inputType: 'label', text:'testing'},{fieldLabel: 'Error Source:', name: '@Error_Source', inputType: 'label', text:'testing'},{fieldLabel: 'Error Type:', name: '@Error_Type', inputType: 'label', text:'testing'},{fieldLabel: 'Error Text:', name: '@Error_Text', inputType: 'label', text:'testing'},{fieldLabel: 'Error Description:', name: '@Error_Description', inputType: 'label', text:'testing'},{fieldLabel: 'Fixed:', name: '@Error_Status', inputType: 'checkbox'}
],
buttons: [
{
text: 'Save'
}, {
text: 'Cancel',
handler:function(){
formwindow.close();
}
}
]
});

If you look at the code you'll see there is labels on the FormPanel yet it all displays as textfields.

Kloon
25 Feb 2010, 10:14 PM
Got it working now, used xtype: 'displayfield' and not text:'Testing' but value:'Testing'