var app={};
Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
Ext.BLANK_IMAGE_URL = '../ext3.0/images/default/s.gif';
var bqarrayDatas = [[1, '非版权图片'], [2, '版权图片'], [3, '限制版权图片']];
var bqsimpleStore = new Ext.data.SimpleStore({
fields: ["retrunValue", "displayText"],
data: bqarrayDatas
});
app.addForm = new Ext.form.FormPanel({
title : 'jjk说:你们好',
applyTo:"me",
frame:true,
id: 'jjk的Grid',items: [{
xtype:'combo',
store: bqsimpleStore,
allowBlank:false,//该选项值不能为空
valueField :"retrunValue",
displayField: "displayText",
//数据是在本地
mode: 'local',
//forceSelection: true,必须选择一项
emptyText:'请选择版权信息...',//默认值
hiddenName:'hbqxx',//hiddenName才是提交到后台的input的name,这里hiddenName的值不能与id相同,否则你会发现一个问*_*题
editable: false,//不允许输入
triggerAction: 'all', //因为这个下拉是只能选择的,所以一定要设置属性triggerAction为all,不然当你选择了某个选项后,你的下拉将只会出现匹配选项值文本的选择项,其它选择项是不会再显示了,这样你就不能更改其它选项了。
fieldLabel: '版权信息',
id : 'bqxx',
name: 'nbqxx',
width: 130
}],
buttons: [{
id:'submit',
text: ' 提 交 ',
handler: function(){
if(app.addForm.getForm().isValid()){
Ext.getCmp("submit").disable();
app.addForm.getForm().submit({
clientValidation: true,
url: '/ypzlk/Tgxx.jsp',
method : 'POST',
success: function(form, action){
Ext.MessageBox.alert('success');
},
failure: function(form, action) {
Ext.Msg.alert('failure');
}
});
}
}
}]
})
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jjk_02027/archive/2009/09/16/4560204.aspx