PDA

View Full Version : the height of field in a form always changes when I render the form panel each time



rodneymckay
7 Apr 2008, 6:04 AM
hi ,all.
I wrote the following code to build a form.


var btnCreateSmeta=function(){
var createCpxFrm= new Ext.FormPanel({
labelWidth: 75,
url:'cpxmeta/save',
frame:true,
title:'创建复合元数据',
bodyStyle:'padding:5px 5px 0',
width: 350,
height:400,
defaults: {width: 230},
defaultType: 'textfield',
items:[{
fieldLabel:'名称',
name:'mname',
allowBlank:false
},
new Ext.form.TextArea({
fieldLabel:'描述',
name:'mdesc'
})
],
buttons:[
{
text:'保存',
formBind:true,
handler:function(){
createCpxFrm.getForm().submit({
method:'POST',
waiTitle:'正在保存',
waitMsg:'请稍后...',
success:function(){
Ext.Msg.alert('保存','成功保存');
},
failure:function(form,action){
Ext.Msg.alert('保存','保存失败');
}
});
}
}
]
});
// render the containner
//createSmetaFrm.render('newCpxmeta');

win=new Ext.Window({
layout:'fit',
width:400,
height:200,
closable:true,
resizable:false,
plain:true,
items:[createCpxFrm]
});
win.show();
};
everything was right except that the height of the field in this form always changed when the form was rendered each time
the wrong pic is :
http://lh6.google.com/jacqureline/R_on_1T4GJI/AAAAAAAAABk/e8vDi9aFAeI/wrong2.jpg?imgmax=720
but it should be:
http://lh6.google.com/jacqureline/R_on_1T4GJI/AAAAAAAAABk/e8vDi9aFAeI/wrong2.jpg?imgmax=720
thanks for any help.