Updated about a year ago by mrun – How-tos – 2 comments – viewed 16,117 times
( +7 / -2 )
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.
If you have a form, you sometimes need special validation Rules not included in Yii. Here i share a special rule with you, i just wrote. Maybe you have the case, when a user needs to Fill ou Field A oder the Fields B, C and D.
This is a reference to be used for Model rule validation and is compiled from the Yii documentation and code. The purpose is to have all the information gathered in one place instead of scattered. This reference is not an intro.
See The Definitive Guide to Yii, Declaring Validation Rules for a tutorial.
Updated 5 years ago by nkd – How-tos – 4 comments – viewed 39,384 times
( +18 / -1 )
I needed British (dd/mm/yyyy) formatted dates throughout my application but found it very difficult to find examples of how to do this - until I found this excellent forum post http://www.yiiframework.com/forum/index.php?/topic/3649-dealing-with-i18n-date-formats/