0

Recently I noticed some issue on my ActiveForm Date field. The field shows "CURRENT TIMESTAMP". I tried to overrule the same by adding "Value", "Placeholder" attribute but unfortunately failed.
I tried couple of other solution like this for the resolve the same. But also failed.

enter image description here

Can anyone help me resolve this issue? For your references I am sharing my ActiveForm here

 <div class="row">
        <div class="col-md-4">
            <?= $form->field($model, 'invt_start_date')->widget(\yii\jui\DatePicker::class, [
                //'language' => 'ru',
                'dateFormat' => 'php:Y-m-d',
                'clientOptions' => [
                    'changeMonth' => true,
                    'changeYear' => true,
                    'showButtonPanel' => true,
                    'yearRange' => '1990:2030',
                    'value' => date('Y-m-d'),
                ],
                'options' => ['class' => 'form-control', 'readOnly' => true, 'placeholder' => 'Enter the Project Start Date'],
            ]) ?>
        </div>
        <div class="col-md-4">
            <?= $form->field($model, 'invt_end_date')->widget(\yii\jui\DatePicker::class, [
                //'language' => 'ru',
                'clientOptions' => [
                    'changeMonth' => true,
                    'changeYear' => true,
                    'showButtonPanel' => true,
                    'yearRange' => '1990:2030',
                ],
                'options' => ['class' => 'form-control', 'readOnly' => true, 'placeholder' => 'Enter the Project End Date','value' => date('Y-m-d')],
            ]) ?>
        </div>
MIK
  • 876
  • 1
  • 16
  • 37
  • Did you tried to check if the `model` initial data exist, like it shows in your link? `if (!$model->data) $model->data = date('Y-m-d');` – Serghei Leonenco Feb 19 '22 at 20:41
  • In my case I need to show my placeholder text instead of "CURRENT TIMESTAMP". – MIK Feb 20 '22 at 04:50
  • Depends on what data is loaded in model. If you want to forcefully display placeholder instead of value then empty attribute value. For example, `$model->attribute = '' or null` – Insane Skull Feb 21 '22 at 12:46

0 Answers0