I’ve been trying to get a ‘Change Password’ dialog working for 3 days! No such luck
Yes I have read the Docs…Yes I have Googled it…Yes I have looked at/read numerous listed sites…I’m at a loss. Please don’t ask “What have you tried?” Answer: So many things I can’t remember ALL of them.
Currently it seems like I’m actually going backwards, as I’m getting the sub form displayed ON the page, but NOT as a pop-up. I have never gotten any version of a link/button to show it. Site Source code looks like everything is there buuuutttttt…
In the master-view /site/userView.php:
/* @var $this SiteController or UserController */
/* @var $userModel User */
/* @var $profileModel Profile */
...
<h2>Logon Information</h2>
<?php
echo $this->renderPartial('/site/_userView', array(
'userModel' => $userModel));
?>
<h2>Profile Information</h2>
<?php
echo $this->renderPartial('/site/_profileView', array(
'profileModel' => $profileModel));
?>
In the sub-view /site/_userView.php:
/* @var $this SiteController or UserController */
/* @var $userModel User */
$this->widget('zii.widgets.CDetailView', array(
'data' => $userModel,
'attributes' => array(
...
array(
'name' => 'password',
'type' => 'raw',
'value' => CHtml::ajaxLink(
CHtml::encode('Change Password'),
Yii::app()->createUrl('/site/changePassword', array('id' => $userModel->id)),
array(
'onclick' => "$('#passwordDialog').dialog('open'); return false;",
'update' => "#passwordDialog"
),
array('id' => 'showPasswordDialog')
),
),
...
'last_login:datetime',
),
));
?>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id' => 'passwordDialog',
'options' => array(
'title' => Yii::t('site', 'Change Password'),
'autoOpen' => true,
'modal' => 'false',
'width' => 'auto',
'height' => 'auto',
),
));
echo $this->renderPartial('_changePasswordForm', array('userModel' => $userModel));
$this->endWidget('zii.widgets.jui.CJuiDialog'); ?>
In the Chnage Password Form /site/_changePasswordForm.php:
<?php
/* @var $this SiteController or UserController */
/* @var $userModel User */
/* @var $form CActiveForm */
?>
<div class="wide form">
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'password-form',
'enableAjaxValidation' => false,
));
?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($userModel); ?>
<div class="row">
<?php echo $form->labelEx($userModel, 'newPassword'); ?>
<?php echo $form->passwordField($userModel, 'newPassword', array('size' => 30, 'maxlength' => 128)); ?>
<?php echo $form->error($userModel, 'newPassword'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($userModel, 'comparePassword'); ?>
<?php echo $form->passwordField($userModel, 'comparePassword', array('size' => 30, 'maxlength' => 128)); ?>
<?php echo $form->error($userModel, 'comparePassword'); ?>
</div>
<div class="row buttons">
<?php
// CHtml::ajaxButton($label, $url, $ajaxOptions, $htmlOptions)
echo CHtml::ajaxSubmitButton(
Yii::t('job', 'Create Job'),
Yii::app()->createUrl('/site/changePassword', array(
'id' => $userModel->id,
'render' => false,
)),
array('success' => 'javascript: function(data) {
$("#passwordDialog").dialog("close");
}'),
array('id' => 'closePasswordDialog'));
?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
I don’t have the SiteController::actionChangePassword action yet. I wanted to get an error/response before I dug into the action. But I’m not even getting a dialog. I have changed the autoShow to true just to see the dialog, it did work for a while…doesn’t now.
Can anybody help…Please