给待编辑的文本(a)添加“编辑结束事件”(控制按钮显示事件)

var aText = this.options.form.getWidgetByName("a"); // 获取A控件(s)
var bText = this.options.form.getWidgetByName("b"); // 获取B控件(s)
var bt = this.options.form.getWidgetByName("bt"); // 获取按钮(s)
var aTextValue = aText.getValue() //获取控件实际值
if(aTextValue!=""){
bt.setEnable(true) // 设置控件可用
//bText.setValue(aTextValue) //赋值控件实际值(取消注释,可不用操作第二步,直接赋值)
}
// 补充
else {
bt.setEnable(false) // 设置控件不可用
bText.reset(); // 清空b控件的值
}
2. 给按钮(bt)添加“点击”事件(赋值)
var aText = this.options.form.getWidgetByName("a"); // 获取A控件(s)
var bText = this.options.form.getWidgetByName("b"); // 获取B控件(s)
var bt = this.options.form.getWidgetByName("bt"); // 获取按钮(s)
var aTextValue = aText.getValue() //获取控件实际值
if(aTextValue==""){
bt.setEnable(false) // 设置控件不可用
}
else {
bt.setEnable(true) // 设置控件不可用
bText.setValue(aTextValue) //赋值控件实际值
}
001-JS给控件赋值.rar