Answer the question
In order to leave comments, you need to log in
How to write an arbitrary value in _form.php?
There is a form _form.php, it has all sorts of fields:
<?php $form = ActiveForm::begin(); ?>
....
<?= $form->field($model, 'create_by')->textInput() ?>
....
// Тут нужно сохранить дату модификации
<?php $model->modified_time = date('Y-m-d H:i:s'); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
Answer the question
In order to leave comments, you need to log in
Try to create a hidden input with a date like so:
<?= $form->field($model, 'modified_time', [
'template' => "{input}"
])->hiddenInput(['hidden' => 'hidden', 'value' => date('d.m.Y')])
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question