您的位置:首页 > Web前端 > JavaScript

EXTJS4.0 页面间传值 监听事件的使用 值处理

2014-12-10 13:46 316 查看
第一种,监听事件进行数据的验证

listeners:{

blur:function(text,obj){

var startTime = dataForm.down("datefield[name='beginTime']").getValue();

var endTime = dataForm.down("datefield[name='endTime']").getValue();

validationTime(startTime,endTime,'结束日期应大于结束日期!');

}

}

第二种,监听事件进行本页面间的传值

listeners:{

blur:function(field,obj ){

dataForm.down("textfield[name='keyWord']").setValue(field.getValue());

}

}

第三种,监听事件进行页面见传值,同时对值进行处理。举例:对于输入【江苏电话112233】自动生成编号【jsdh112233】

页面部分

listeners:{

blur:function(field,obj ){

Ext.Ajax.request({

url : 'AirportActivity_setKeyWord.action' + '?getTitle=' + cares.Decode(field.getValue()),

scope : this,

success : function(response, opts) {

var json = eval('('+response.responseText+')');

var msg = json.msg;

dataForm.down("textfield[name='keyWord']").setValue(msg);

}

});

}

}

后台部分:

public String setKeyWord(){

try {

String title = getParamByName("getTitle");

if(StringUtils.isNotEmpty(title)){

Msg = title;

}

} catch (Exception e) {

throw new RuntimeException(e);

}

success = true;

return SUCCESS;

}

这里的后台我已经配置好了,其中Msg是一个String类型的变量,可以返回到页面
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐