Note that there are some explanatory texts on larger screens.

plurals
  1. POHow To Override A Variable In A Form And Submit
    primarykey
    data
    text
    <p>I'm working on a password reset form that has the following fields</p> <pre><code>&lt;==Username==&gt; &lt;==Current Password==&gt; &lt;==New Password==&gt; &lt;==Confirm Password==&gt; </code></pre> <p><strong>View code</strong></p> <pre><code> &lt;div class="row"&gt;&lt;?php echo $form-&gt;labelEx($model,'username'); echo $form-&gt;textField($model,'username',array('size'=&gt;45,'maxlength'=&gt;150)); echo $form-&gt;error($model,'username'); ?&gt; &lt;/div&gt; &lt;div class="row"&gt;&lt;?php echo $form-&gt;labelEx($model,'Current password'); $model-&gt;password=""; echo $form-&gt;textField($model,'password',array('size'=&gt;45,'maxlength'=&gt;150)); echo $form-&gt;error($model,'password'); ?&gt; &lt;/div&gt; &lt;div class="row"&gt;&lt;?php echo $form-&gt;labelEx($model,'New password'); $model-&gt;password=""; echo $form-&gt;passwordField($model,'password',array('size'=&gt;45,'maxlength'=&gt;150)); echo $form-&gt;error($model,'password'); ?&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;?php echo $form-&gt;label($model,'password_repeat'); ?&gt; &lt;?php echo $form-&gt;passwordField($model,'password_repeat',array('size'=&gt;45,'maxlength'=&gt;150)); ?&gt; &lt;?php echo $form-&gt;error($model,'password_repeat'); ?&gt; &lt;/div&gt; &lt;div class="row buttons"&gt;&lt;?php echo CHtml::submitButton('Reset Your Password'); ?&gt;&lt;/div&gt;&lt;?php </code></pre> <p><strong>Controller code</strong></p> <pre><code> public function actionUpdate($id) { $model = $this-&gt;loadModel($id); // set the parameters for the bizRule $params = array('GroupzSupport'=&gt;$model); // now check the bizrule for this user if (!Yii::app()-&gt;user-&gt;checkAccess('updateSelf', $params) &amp;&amp; !Yii::app()-&gt;user-&gt;checkAccess('admin')) { throw new CHttpException(403, 'You are not authorized to perform this action'); } else { if(isset($_POST['GroupzSupport'])) { $model-&gt;attributes=$_POST['GroupzSupport']; $model-&gt;password = $model-&gt;hashPassword($_POST['GroupzSupport']['password']); if($model-&gt;save()) $this-&gt;redirect(array('admin','id'=&gt;$model-&gt;id)); } $this-&gt;render('update',array( 'model'=&gt;$model, )); } } </code></pre> <p>I have the following password field that needs to be updated into database. I need to use password variable for new password field. Now, I need to override the current password to new password and save it. How can I do this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload