Search code examples
formsyii2default-value

Yii2 - default value only if the record is new


I want to add a default value (current date) only when the record is new. When I edit the record, the date should not be overwritten.


Solution

  • pass the value of date using model if its new record provide current date and if existing pass the exists date.