Mika, thx, this is a very helpful one.
Today I ran into another one, I was trying to access the field attribute of a validator inside the class, got an undefined all the time. The docs states that the field propery is not to be set in ActionScript, is it not accessable at all? app.mxml: <MyOwnValidator field="model.bla" /> inside of MyOwnValidator.as: class MyOwnValidator extens mx.validators.EmailValidator { public var myfield = ??? ; ... } Cheers Kai MK> Oops, this is the problem I was trying to answer to. Sorry folks about the MK> previous post... :) MK> Class MyDateValidator extends mx.validators.DateValidator MK> { MK> public function validationError(errorCode:String, MK> defaultMessage:String,subfield:String):Void MK> { MK> If (errorCode == wrongLength) MK> defaultMessage = yourTranslatedMessage; MK> super.validationError(errorCode, defaultMessage, subfield); MK> } MK> } MK> Only thing you need to do is catch the wrongLength error and re-write the MK> error message yourself. MK> -Mika MK> -----Original Message----- MK> From: flexcoders@yahoogroups.com MK> [mailto:[EMAIL PROTECTED] On MK> Behalf Of Kai König MK> Sent: 17. elokuuta 2005 16:56 MK> To: flexcoders@yahoogroups.com MK> Subject: [flexcoders] Changing the wrongLengthError in a DateValidator MK> Hi all, MK> another validator-related question: MK> Having to validate for a date using a DateValidator, the requirements MK> are to just deliver one validation message if the validation fails. MK> Following the concept, I'd have to add a long list of attributes to my MK> validator call, as in: MK> <mx:DateValidator ... invalidCharError="blabla" MK> invalidFormatCharsError="blabla" ... /> MK> So we thought it might be nice to subclass the DataValidator and to MK> define a defaultErrorMessage which we can pass into our own validator MK> class and internally, the class is responsible to overwrite the values MK> of the pre-defined errors. MK> Works quite good, BUT doesn't work for wrongLengthError. The docs MK> state: >>Error message when the length of the date doesn't match that of the >>inputFormat. Default is "Please type the date in the format >><i>inputFormat</i>.". MK> That means the default error might be something like: MK> "Please...format mm/dd/yyyy" MK> As far as I understand, I'd expect to be able to overwrite the default MK> with anything I like, but regardless to what I set the value for MK> wrongLengthError, Flex always adds the value of inputFormat to my MK> error message - I end up with something like MK> "This is my errortext and I want you to type it correct mm/dd/yyyy" MK> This is especially annoying with localized error messages in which the MK> inputFormat has to be at another place within the error message by MK> grammar: "Bitte nutzen Sie das Format dd.mm.yyyy in diesem Feld". MK> Is there a way to get rid of the automatic concatenation of the MK> inputFormat within the wrongLengthError of this validator? MK> Cheers MK> Kai MK> -- MK> Flexcoders Mailing List MK> FAQ: MK> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt MK> Search Archives: MK> http://www.mail-archive.com/flexcoders%40yahoogroups.com MK> Yahoo! Groups Links MK> -- MK> Flexcoders Mailing List MK> FAQ: MK> http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt MK> Search Archives: MK> http://www.mail-archive.com/flexcoders%40yahoogroups.com MK> Yahoo! Groups Links -- Best regards, Kai mailto:[EMAIL PROTECTED] ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h6vcbsa/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124380306/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org ">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy</a>.</font> --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/