So I am fiddling with the Yii Framework and in one of the views, specifically the create form, I am trying to give one of my textfields a default value. Therefore when I go onto
Always, is a good idea deal with data (defaul values, change after something happening, data treatment, etc) on the model class.
If you're getting the value from after initialize the model, the best way is to use the method init().
But, if you want to change, or define a default value after load data from the database, you can use the method afterFind()
For example:
public function afterFind(){
$this->localdate = date("Y-m-d");
parent::afterFind();
}
This link has a lot of usefull information about these methods: http://www.yiiframework.com/doc/guide/1.1/en/database.ar#customization