Nick, thank you very much for your response The problem with this code is that I can't customize the message, i need to show the message in Spanish to the users.
On 27 mayo, 03:52, Nicholas Kilian <[email protected]> wrote: > And greeting from South Africa. > > I've never played with the OnNotValid hook before, I just make a call to > IsValid before saving and handle the resulting errors from there... > > If Not Me.IsValid() Then > For Each errStr As String In Me.ValidationErrorMessages > LogError(errStr) > Next > ...or > For Each prop As Reflection.PropertyInfo In > Me.PropertiesValidationErrorMessages.Keys > For Each errString As String In > PropertiesValidationErrorMessages(prop) > LogError(prop.Name, errString) > Next > Next > Else > Me.Save() > End If > > You could use either ValidationErrorMessages or > PropertiesValidationErrorMessages to iterate over the errors and log or > display them to the user. > > Your attribute is defined correctly to generate the custom error message. > > Regards > Nick > > > > > > > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of Tomás Escamez > Sent: 26 May 2011 08:32 PM > To: Castle Project Users > Subject: Problem with Validations > > Hello, > I'm new in the Castle AR and I have some problems in the implementation. > I want to use the ActiveRecordValidationBase and i like to customize the > message. I found this example: > > [ValidateEmail("Not a valid email")] > public String Email > { > get { return email; } > set { email = value; } > } > > I think i have to use the method OnNotValid(), but i get the default error > message. > Anyone have a sample code to take the custom exceptions? > > Thank you a lot, and sorry for my english. > > Greetings from Argentina. > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/castle-project-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
