Validation is not firing

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 22-Nov-2010 14:51:24   

I've built a custom validator. The problem is I'm setting the values like

entity.Fields[ProjectFields.Id.Name].CurrentValue = -1.5m;

The problem with this approach is the ValidateFieldValue method wont be called.

Is there any to validate the values ?

I'm using the 2.6 version

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 22-Nov-2010 16:20:29   

I'd suggest not setting the value through CurrentValue, but I think you have a good reason for doing this.

A workaround is to to validate the Entity, using entity.ValidateEntity() and there you should validate the entity's fields.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 22-Nov-2010 17:02:21   

use the SetNewFieldValue() method on the entity instead of setting CurrentValue.

Frans Bouma | Lead developer LLBLGen Pro