`
领悟人生
  • 浏览: 85021 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Ext 正则表达表验证输入

    博客分类:
  • Ext
EXT 
阅读更多
//money
Ext.form.VTypes['moneyVal'] = /^[-+]?\d+(\.\d{1,2})?$/i;
Ext.form.VTypes['moneyText'] = '所输入的金钱格式不正确';
Ext.form.VTypes['moneyMask'] = /[-+0-9.]/;
Ext.form.VTypes['money'] = function(v) {
 return Ext.form.VTypes['moneyVal'].test(v);
};
//numeric
Ext.form.VTypes['numericVal'] = /^[0-9]+$/i;
Ext.form.VTypes['numericText'] = '输入的数字不正确';
Ext.form.VTypes['numericMask'] = /[0-9]/;
Ext.form.VTypes['numeric'] = function(v) {
 return Ext.form.VTypes['numericVal'].test(v);
};
//chinacardid
Ext.form.VTypes['chinaCardIdVal'] = /^\d{15}|\d{17}[\dXx]$/;
Ext.form.VTypes['chinaCardIdText'] = '身份证号码格式不正确';
Ext.form.VTypes['chinaCardIdMask'] = /[0-9]/;
Ext.form.VTypes['chinaCardId'] = function(v) {
 return Ext.form.VTypes['chinaCardIdVal'].test(v);
};
//使用


fieldLabel: '身份证号,
 name: 'guest_chinaCardId',
 id: 'guest_chinaCardId',
 vtype: 'chinaCardId'
}
  
//一定要记得Ext.QuickTips.init(); 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics