Yii2 Help

Hi There,

This is my 3rd Yii project, previously I had done them in Yii but now I am using Yii 2.

Quite a lot of stuff has changed, although I see the mvc concepts use are still quite similar.

Anyhow I wanted to get some help. I have this view:


 <?= $form->field($model, 'userdata_email') ?>

And I also have a function inside the model:




public function attributeLabels()

    {

        return [

            //some other fields..

            'userdata_username' => 'Username',

            'userdata_password' => 'Password',

            'userdata_lastlogin' => 'Last Login',

            'userdata_email' => 'Email Address'

        ];

    }



Yet it keeps outputting this HTML in my application:


<label class="control-label" for="passwordresetrequestform-userdata_email">Userdata Email</label>

<input type="text" id="passwordresetrequestform-userdata_email" class="form-control" name="PasswordResetRequestForm[userdata_email]">

In Yii 1 I was about 90% sure you just changed the label attributes and it worked…

I really want it to say Email Address in the label. I tried using the 3rd argument with [‘name’ => ‘Email Address’] but that didnt budge either. I couldnt quite understand what the manual of this was going on about http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#getAttributeName()-detail can anyone help explain to me what I am doing wrong to the label says Email Address?

Hmm. Editing wrong file?

Your view is using the passresetrequestform model but it looks like you have edited the label in the user model. Modify models\PasswordResetRequestForm attributeLabels and it should be good!