The MaxChars i could use it to restrict it with the textinput properties.

all of these rules come from the xml so i loop through the rules and
add the validation.

what about if i need to set min lenght for zipcode and validate just
numbers. 

These aren't the real deal anyway just examples.

I know that some of these i can work it out on the textinput api but
my question was "Multi Validation, can it be done?" 

Like Can i combine 2 validators. Because i want it to validate and
display the tooltip to show the error.

Please... someone?!

raf


--- In flexcoders@yahoogroups.com, "Douglas Knudsen"
<[EMAIL PROTECTED]> wrote:
>
> I'm guessing you are using a TextInput.  Check the API
> http://livedocs.adobe.com/flex/2/langref/mx/controls/TextInput.html
> in particular, look at restrict property to restrict a field to
whatever you
> want.
> 
> DK
> 
> On Nov 20, 2007 9:25 PM, Rafael Faria <[EMAIL PROTECTED]> wrote:
> 
> >   There is any way to validate one field with 2 or more types of
> > validation?
> >
> > like
> >
> > i want a field that needs to be with max length of 30 char and all
> > needs to be a number
> >
> > or i need to validate an email that needs to be maxlenght of 30 (just
> > to give an example)
> >
> > how i would do that... because i have a function that validate
each field
> >
> > something like that..
> > it works just fine... but the thing is that one validation REPLACE the
> > latest one...
> >
> > any thoughts?
> >
> > switch(rule)
> > {
> > case 'phone':
> > var phoneValidator:PhoneNumberValidator = new
> > PhoneNumberValidator();
> > phoneValidator.source = id;
> > phoneValidator.property = "text";
> > phoneValidator.required = ((validation.match("required")) ?
> > true: false );
> >
> > formValidate.push
> > ({'validator':phoneValidator,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'email':
> > var emailValidator:EmailValidator = new EmailValidator();
> > emailValidator.source = id;
> > emailValidator.property = "text";
> > emailValidator.required = ((validation.match("required")) ?
> > true: false );
> >
> > formValidate.push
> > ({'validator':emailValidator,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'currency':
> > var curValidator:CurrencyValidator = new CurrencyValidator();
> > curValidator.source = id;
> > curValidator.property = "text";
> > curValidator.required = ((validation.match("required")) ? true:
> > false );
> >
> > formValidate.push
> > ({'validator':curValidator,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'number':
> > case 'alpha_numeric':
> > var nv:NumberValidator = new NumberValidator();
> > nv.source = id;
> > nv.property = "text";
> > nv.required = ((validation.match("required")) ? true: false );
> >
> > formValidate.push({'validator':nv,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'socialsecurity':
> > var ss:SocialSecurityValidator = new SocialSecurityValidator();
> > ss.source = id;
> > ss.property = "text";
> > ss.required = ((validation.match("required")) ? true: false );
> >
> > formValidate.push({'validator':ss,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'max_length':
> > var num:RegExp = /\[\d{1,3}\]/g;
> > var ml:String = rules[i].match(num);
> > var nameValidator:StringValidator = new
> > StringValidator();
> > nameValidator.source = id;
> > nameValidator.property = "text";
> > nameValidator.maxLength = (ml ?
> > parseInt(ml.replace("]","").replace("[","")) : 255);
> > nameValidator.required =
> > ((validation.match("required")) ? true: false );
> >
> > formValidate.push
> > ({'validator':nameValidator,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'zipcode':
> > var zipValidator:ZipCodeValidator = new ZipCodeValidator();
> > zipValidator.source = id;
> > zipValidator.property = "text";
> >
> > formValidate.push
> > ({'validator':zipValidator,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'date':
> > var dtv:DateValidator = new DateValidator();
> > dtv.source = id;
> > dtv.inputFormat = "dd/mm/yyyy";
> > dtv.property = "text";
> > dtv.required = ((validation.match("required")) ? true: false );
> >
> >
formValidate.push({'validator':dtv,'source':id,'fieldname':fieldname});
> >
> > break;
> > case 'creditcard':
> > break;
> >
> > }
> >
> >  
> >
> 
> 
> 
> -- 
> Douglas Knudsen
> http://www.cubicleman.com
> this is my signature, like it?
>


Reply via email to