日期:2014-05-16 浏览次数:20532 次
{xtype:'textfield',
id:'storeArea',
name: 'storeArea',
fieldLabel: '仓库面积(平方米)',
vtype:'area',
regex:/^[0-9]+(.[0-9]{0,6})?$/,
regexText:'用正数组成小数点后面不能超过6位',
maxLength:24,
anchor:'95%'}
Ext.apply(Ext.form.VTypes, {
//面积 限制小数点后的位数的限制,只能输入小数点后的6位 22.222222
"area":function(_v){
return /^[0-9]+(.[0-9]{0,6})?$/.test(_v); //利用正则来和传进来的值进行判断
},
"areaText": "只能用正数组成小数点后面不能超过6位", //用来提示的作用
"areaMask":/[0-9\.]/i //只准用户填入 0-9 和 . 其他的就接受不了
});
//在jsp页面中先调用js再直接调用 vtype("area")
//例如:
{xtype:'textfield',
id:'storeArea',
name: 'storeArea',
fieldLabel: '仓库面积(平方米)',
vtype:'area',
maxLength:24,
anchor:'95%'}