Sorry just a little confused on the language used. What is DDD and I’m assuming you meant phone number.
I get that the two are together as one string so whatever format DDD is and then DDDXXXXXXXXXX (where you have area code and then 7 digit phone number).
If you can clarify a little I’d be glad to give you some advice on rule sets.
Conditional rules are not available so far, but you may want to extend beforeValidate() of your model, and add an error and deny the saving process by returning false.
Once you extend it, just make a new function that takes the two parameter values, DDD and phone #.
Then inside that function just do your logic:
if(DDD != NULL)
{
// make sure phone # is also not Null
// Do any other rules and checks you want to do
return true; // for a pass
return false; // for a fail - this will effectively stop the save process until the input is corrected by the user.
}
Then in your model just assign the rule:
array('DDD', 'phone#', 'myCustomRuleFunction');
Not sure if you’d join the DDD and phone# as one but that would imply you’re doing the same function to both which would not be accurate.
Now an alternative, since you have it stored in the DB as one string, you can just pass the DDD and if it’s inputted (not null) then you can still access the phone# attribute (from your form) because you’re still in the model and thus it’s all shared). This means you can evaluate and combine them both as 1 to save to the db.