1.前台页面修复
修复效果:
主要对表单输入框的非法字符进行验证:
// 定义通用拦截函数
function findSpecialStr(str){
var reg = /'|"|<|>/;
var result = reg.exec(str);
if(null != result && result.length>0){
return true;
}else{
return false;
}
}
// 表单提交时进行验证
var name = frm.getComponent('name').getValue();
if(findSpecialStr(name)){
Ext.Msg.alert("提示","内容不能含有 \'\' 、\"\"、\<、\> 等非法字符!");
return;
};
- extjs4 修复方法
editor: {xtype: 'textfield',
regex:/^[^'"<>]*$/,
regexText : '内容不能含有 \'\' 、\"\"、\<、\> 等非法字符!',
allowBlank: true}
修复效果: