Revision #3 was created by Boaz on Sep 11, 2012, 1:32:59 PM.
indentation etc.
Content
Problem
------------------
In a nutshell, the task at hand is to mark (or render) a model attribute in the typical "_form.php" view file with the 'required' red asterisk while this attribute is not marked as required in the model's rule() method.
If you're interested only in the solution, jump ahead to the 'solution' section below.
[...]
Consider the following use case:
- You have a model with two phone numbers attributes: _phone_ and _fax_. Phone is q required field while fax is not. Yet, if submitted, both should be validated as 'phone numbers', hence use a custom validator class, [PcSimplePhoneValidator](http://www.yiiframework.com/extension/pcsimplephonevalidator/)).
- So, you're rules() method will need to look like this: