日期:2014-05-16 浏览次数:20366 次
var alpha = /^[a-zA-Z_]+$/; //字母和下划线 var alphanum = /^[a-zA-Z0-9_]+$/; //字母、数字和下划线 var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,4}$/;//邮箱 var url =/(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]* )(\.\w{2,})?)*\/?)/i;//网址 var email_add = new Ext.form.TextField({ name: "email", fieldLabel: "电子邮件地址", vtype: "email", width: 200 });
var password_add = new Ext.form.TextField({ name: "password", id:"pass1", fieldLabel: "用户密码", inputType: "password", width: 200 }); var password1_add = new Ext.form.TextField({ name: "password1", id:"pass2", fieldLabel: "请在输入一次", inputType: "password", vtype:'password', confirmTo:"pass1",//要比较的另外一个的组件的id vtypeText:"两次密码不一致!", width: 200 }); Ext.apply(Ext.form.VTypes,{ password:function(val,field){//val指这里的文本框值,field指这个文本框组件,大家要明白这个意思 if(field.confirmTo){//confirmTo是我们自定义的配置参数,一般用来保存另外的组件的id值 var pwd=Ext.get(field.confirmTo);//取得confirmTo的那个id的值 return (val==pwd.getValue()); } return true; } });