功能要求:在master plan系统中,copy一个新的masterplan时,添加一个有输入框的提示框,使项目名称可编辑 如图所示:
思路:在form中添加一个隐藏字段,然后将用户输入的项目名称设置到隐藏字段中,提交后台….
添加隐藏字段:
this.fields.add("project_hidden",new Ext.form.Hidden ({xtype: "hidden",name:"project_hidden",id:"project_hidden",width:150,allowBlank:false,labelSeparator:":*" ,fieldLabel: "project_hidden",insert_allowed:true,update_allowed:true}));
提示框
Ext.Msg.show({
title:'Copy',msg: '您將copy一個新的master plan,是否修改項目名('+project_id+')?',buttons: Ext.Msg.YESNO,modal:false,scope:this,icon: Ext.MessageBox.QUESTION
,fn: function(btn,txt){
if (btn=='yes') {
if (this.fields.get('MP_ID_manipulate').getValue() != this.fields.get('MP_ID').getValue()){
Ext.Msg.alert('操作不成功,請重試!');
}else{
this.fields.get('project_hidden').setValue(txt); //将输入值设置到虚拟字段中
console.log("the test value is :==="+this.fields.get('project_hidden').getValue()+"-----txt is -----"+txt);
if (!MasterWriteAccess && !this.getCommitAllowVariable()) this.commitForm();
}
}
},prompt:true//显示输入框
});