Why when I’m updating a form it doesn’t display the value it displays only ‘(not set)’
In my form whenever I click the update button it automatically gets the current server time but when I update it it doesn’t display on the view
Controller
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
$model->time_end = date("d-m-Y H:i:s");
return $this->render('update', [
'model' => $model,
]);
}
}
_form
<?= $form->field($model, 'time_end')->widget(DateTimePicker::className(),
[
'value' => date('d-m-Y H:i:s'),
'disabled' => true
]
I also used it on my actionCreate and it works fine.