my text input dissappear after submit

I have this




<?php echo $form->textField($model,'WORDS'); ?>



and other input stuff in my form…after I submit and then the grid got updated,

ofcourse the page refreshed, my text input in those input forms disappeared, how can my input stay inside the input forms even after I submitted the form itself ?

Dear Sasori

Let us have a model "MyModel" with an unique attribute "uniqueAttribute".

The following code in controller method, I hope, would serve the purpose.




public function actionRemain()

{

                $model=new MyModel;

		if(isset($_POST['MyModel']))

                {

		if(MyModel::model()->exists('uniqueAttribute=:uniqueAttribute',array('uniqueAttribute'=>$_POST['MyModel']['uniqueAttribute'])))

		  $model=Patient::model()->find('uniqueAttribute=:uniqueAttribute',array('uniqueAttribute'=>$_POST['MyModel']['uniqueAttribute'])))

		else $model=new MyModel;


		$model->attributes=$_POST['MyModel'];


		if($model->save())

                      {

		             $model=$this->loadModel($model->id);

		      }

		}

		 	

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

}



If you save the form first time it is going to insert the record.Subsequent submissions are going to update the

record unless you change the uniqueAttribute.

Regards.