Help: why is Ext.Array is undefined when creating a custom validation for a field.
Hi all,
I am trying to do a custom validation on a textfield form.
The field hold as value a list of email addresses.
here is my custom validation
Ext.apply(Ext.form.VTypes,{
emailList: function(val, field){
parent=this;
var emails=field.getValue();
var regex=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;;
var email = emails.split(',');
var result= new Array();
for (var i = 0; i < email.length; i++) {
result= regex.test(email[i]);
}
//check if an email address is false
if( Ext.Array.indexOf(result,'false') )
return true;
else return false;
},
emailListText: 'One or more email addresses entered is invalid in the mailTo fields!'//error message
});
here is my textfield
xtype: 'textfield',
width: 673,
anchor: '100%',
name : 'mailTo',
fieldLabel: 'Mail To',
vtype : 'emailList',
allowBlank : false,
enableKeyEvents : true
when i entered any value in the field mailto, i got the following error Ext.Array is undefined .
Thank you for your help
hola, yo utilizo el siguiente vtype y me funciona, espero te sirva
Ext.apply(Ext.form.VTypes, {
// This function validates input text with address mail´s
emailList: function(v) {
var cad = v.split(',');
if (cad.length > 0){
for(x=0;x
¿Conoces a alguien que pueda responder esta pregunta? Comparte el link en Twitter o Facebook
Es necesario registrarse para poder participar en el foro! Si ya tienes una cuenta puedes entrar y comentar en este foro.