i used the form generator to generate a form.
I’m trying to make a registration form, i removed the fields I don’t need and tired adding an extra password field so I could confirm the password but after adding the code all I get is Property “User.password_repeat” is not defined.
in the view
<div class="row">
<?php echo $form->labelEx($model,'password_repeat'); ?>
<?php echo $form->textField($model,'password_repeat',array('size'=>60,'maxlength'=>128)); ?>
<?php echo $form->error($model,'password_repeat'); ?>
</div>
in the model
public function attributeLabels()
{
return array(
'id' => 'ID',
'username' => 'Username',
'email' => 'Email',
'password' => 'Password',
'password_repeat' => 'Confirm Password',
);
}
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('username, email, password', 'required'),
array('password_repeat', 'required', 'on'=>'register'),
array('password', 'compare', 'compareAttribute'=>'password_repeat', 'on'=>'register'),