Fill textfield with value from database

i got some stuck in thi case, which I want to fill one of the textfield with value from database. Commonly, this code was recommended


<div class="row">

		<?php echo $form->labelEx($model,'field1'); ?>

		<?php echo Model1::model()->FindByPk($model->id)->field1;?>

		<?php echo $form->error($model,'field1'); ?>

	</div>

But,the one I’m searching is the value is filled into textfield at the form.

Could anyone help me?

Thanks… :D

Have you read any of the documentation / user guide?




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



So far, I have… but it didn’t work.

it is solve by this code :


<?php echo Chtml::textField('txtFieldName', Model1::model()->FindByPk($model->id)->field1); ?>

:lol: