Well ive been looking at this and it looks like its not within Yiis functionality, but it looks like you can create a Validator for this. looks like the best aproach to me, I also though about maybe creating a Behavior but it looks smooter if you can add this kind of things to the rules() method in the model: