Q:

In yii how to create widget to display textfields

I am about to build a project in Yii. I want to create a widget in such a way that when user will click button that widget with two text-fields for entering new password and repeat password should get display. Also one button will be provided on widget form in order to submit this new password and store it into database.How can i achieve these?

A:

You need to create a model for your table first, say User. In User table you may have several columns, among one of them is used for storing password say password.
and in your User model, you should define rules like below
array('password, repeat_password', 'required', 'on'=>'signup'),
array('password', 'compare', 'compareAttribute'=>'repeat_password','on'=>'signup'),

the repeat_password is a model variable,that you should declare.
and in form, use something like below
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>

<?php echo $form->labelEx($model,'repeat_password'); ?>
<?php echo $form->passwordField($model,'repeat_password); ?>
<?php echo $form->error($model,'repeat_password'); ?>

I think you are asking about a popup form too, for that check these places
http://www.yiiframework.com/doc/api/1.1/CJuiDialog
http://www.yiiframework.com/wiki/72/cjuidialog-and-ajaxsubmitbutton

