Yii Framework Forum: Blank Textfield In Update Form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Blank Textfield In Update Form Rate Topic: -----

#1 User is offline   AlexInt 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 125
  • Joined: 25-October 13

Posted 28 October 2013 - 07:01 AM

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.
0

#2 User is offline   cynosure 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 25-October 13

Posted 28 October 2013 - 08:03 AM

Hi,

Try this example:
http://www.yiiframew...irmation-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.
0

#3 User is offline   AlexInt 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 125
  • Joined: 25-October 13

Posted 28 October 2013 - 09:44 AM

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users