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(); 

你可能感兴趣的:(ext)