nishitech-1
(Seema Nishitech)
1
i want to id store in hidden filed…
m use these two line…
here $id variable set in default value in hidden filed…
<?php
$id= yii::$app->user->identity->id;
echo $form->Field($model, 'user_id');
?>
what i can changes in code…
robsch
(Robert Schneider)
2
You could do it like this:
<?php
$id= yii::$app->user->identity->id;
echo $form->field($model, 'user_id')
->hiddenInput(['value' => $id])
->label(false);
?>
But I’m not sure if you really want this. Is $model an new object?
vincentdm
(Vincent)
3
Just set a default value in your model and it will be selected in the form upon loading…
foysal
(Foysal Cse12)
4
How to hide (not showing) certain field while update…?
if it’s a new model then you can use the BlameableBehavior or make it a rule.
'rules'=>[
'user_id','default','value'=>Yii::$app->user->id
]