Make a blank field when viewing update in yii booster

40 Views Asked by At

I am using yii booster to make a password field. When I do update action, I want to show a blank field instead of showing the data taken from model. How can I make it? I don't have any clue how to do it.

This is the code in my view.

<?php
    echo $form->passwordFieldGroup($model, 'Password', array(
      'label'=>false,
      'widgetOptions'=>array(
        'htmlOptions' => array()
    )));
?>
1

There are 1 best solutions below

0
ScaisEdge On

You can clear the value before sending to the view ..(but be sure when you obtain the submitted values that these are properly complete before save)

public function actionUpdate($id)
{
    $model=$this->loadModel($id);

    // Uncomment the following line if AJAX validation is needed
    // $this->performAjaxValidation($model);

    if(isset($_POST['........']))
    {
        .........
    }

    // set you value  to ''
    $model->password = '';

    $this->render('update',array(
        'model'=>$model,
    ));
}