Yii2 Confirm Password not working
<p>I am trying to build a signup form, it works fine when I dont use repeat password, it saves to the model, but when I use my repeat password it just does'nt let me save them in the database. My code is below.</p>

<p><strong>SimUser.php file</strong></p>

<pre><code>public function rules()
    {
        return [
            [['user_email', 'user_password_hash','company_id','user_fname', 'user_lname','agree'], 'required'],
            ['agree','required','requiredValue' =&gt; 1, 'message' =&gt; ''],
            ['user_password_hash_repeat', 'compare','compareAttribute' =&gt; 'user_password_hash','message' =&gt; 'Password don\'t match'],
            [['agree'],'safe'],
            [['user_password_hash_repeat'],'safe'],
            [['user_company', 'user_suspended', 'user_deleted'], 'integer'],
            [['user_created'], 'safe'],
            [['user_email'], 'string', 'max' =&gt; 255],
            [['user_password_hash'], 'string', 'max' =&gt; 72],
            [['user_fname', 'user_lname'], 'string', 'max' =&gt; 45],
            [['user_auth_key'], 'string', 'max' =&gt; 32],
            [['user_access_token'], 'string', 'max' =&gt; 100],
        ];
    }
</code></pre>

<p>My controller action: <strong>site/signup</strong></p>

<pre><code> public function actionSignup()
    {
        $company = new Company(); 
        $company-&gt;load(Yii::$app-&gt;request-&gt;post());
        $company-&gt;save();


        $model = new SimUser();
        if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
            $model-&gt;setPassword($model-&gt;user_password_hash);
            $model-&gt;generateAuthKey();
            $model-&gt;company_id =  $company-&gt;company_id;
            //var_dump($model); exit();
            $model-&gt;save();
            $model = new LoginForm();
            return $this-&gt;render('login',[
                'model' =&gt; $model,
            ]);
        }
        return $this-&gt;render('signup', [
            'model' =&gt; $model,
            'company' =&gt; $company,
        ]);
    }
</code></pre>

<p>Here I am saving the comany name in the company model and the others in the user table. </p>

<p>My views file: <strong>signup.php</strong></p>

<pre><code>&lt;h1&gt;Sign Up&lt;/h1&gt; 
                &lt;?= $form-&gt;field($model, 'user_fname')-&gt;textInput(['placeholder'=&gt;'First Name*','class'=&gt;'form-control col-lg-4'])-&gt;label(false);?&gt;
                &lt;?= $form-&gt;field($model, 'user_lname')-&gt;textInput(['placeholder'=&gt;'Last Name*','class'=&gt;'form-control col-lg-4'])-&gt;label(false); ?&gt;
                &lt;?= $form-&gt;field($model,'user_email')-&gt;textInput(['placeholder'=&gt;'Email*','class'=&gt;'form-control col-lg-4'])-&gt;label(false); ?&gt;
                &lt;?= $form-&gt;field($model, 'user_password_hash')-&gt;passwordInput(['placeholder'=&gt;'Password'])-&gt;label(false); ?&gt;
                &lt;?= $form-&gt;field($model, 'user_password_hash_repeat')-&gt;passwordInput(['placeholder'=&gt;'Confirm Password*','class'=&gt;'form-control col-lg-4'])-&gt;label(false); ?&gt;
                &lt;?= $form-&gt;field($company, 'company_name')-&gt;textInput(['placeholder'=&gt;'Company Name*','class'=&gt;'form-control col-lg-4'])-&gt;label(false); ?&gt;
                &lt;?php echo $form-&gt;field($model, 'agree')-&gt;checkbox(); ?&gt;
                &lt;div class="form-group"&gt; 
                    &lt;?= Html::submitButton('Sign Up', ['class' =&gt; 'pull-left padding-0 btn btn-success', 'name' =&gt; 'signup-button']) ?&gt;
                &lt;/div&gt;
</code></pre>

<p>The error message for the company doesn't go, it is always there.. attached output as image <a href="https://i.stack.imgur.com/fFzwi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fFzwi.png" alt="click here"></a>
Can anyone of you help me solve this issue? Thanks in advance!!</p>

<p><strong>Company.php</strong>
   */</p>

<pre><code>public function rules()
{
    return [
        [['company_name'], 'required'],
        [['company_name'], 'string', 'max' =&gt; 75],
    ];
}
</code></pre>