Blank Textfield In Update Form

I’ve got a form to register users and everything works fine. But if I update any user, the password textField shows the current password. ¿How can I change this for a blank textField?

I mean, when someone tries to update I don’t want them to see the current password. Instead of that I want the textField empty.

Hi,

Try this example:

http://www.yiiframework.com/wiki/277/model-password-confirmation-field/

If you use the CActiveForm widget, most of your issue will be solved automatically. You can set default value in the 3rd parameter of the ->passwordField() method:




<?php echo $form->passwordField($model, 'password', array('size'=>50, 'maxlength'=>128, 'value'=>'')); ?>



If you set the beforeSave hook and the validation like in the example above, your code won’t change the passwords to empty in the database, and also lets to submit the form with empty password fields.

Thanks, it’s working. I didn’t realize that the field could just be empty by default.