Suppose we have:
-
‘updatePassword.php’ <-- a form with password, newPassword and newPasswordRepeat fields
-
‘updateEmail.php’ <----- a form with password and email fields
-
‘update.php’ <---------- view with a TbTabs widget with the following code:
<?php $this->widget('bootstrap.widgets.TbTabs', array(
'tabs'=>array(
array(
'id'=>'tab1',
'active'=>true,
'label'=>'Actualizar Dirección Email',
'content'=>$this->renderPartial('/site/index', array('model'=>$model),true)
),
array(
'id'=>'tab2',
'active'=>false,
'label'=>'Actualizar Clave',
'content'=>$this->renderPartial('updatePassword', array('model'=>$model),true)
),
),
)); ?>
The code in updatePassword (updateEmail is similar) is:
<div class="form">
<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'horizontalForm',
'type'=>'horizontal',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Los campos marcados con <span class="required">*</span> son obligatorios.</p>
<br/>
<fieldset>
<?php echo $form->passwordFieldRow($model, 'password', array('class'=>'span3', 'value'=>'','labelOptions'=>array('label'=>'Clave Anterior'))); ?>
<?php echo $form->passwordFieldRow($model, 'passwordNew', array('class'=>'span3', 'value'=>'','labelOptions'=>array('label'=>'Clave Nueva'))); ?>
<?php echo $form->passwordFieldRow($model, 'passwordNewRepeat', array('class'=>'span3', 'value'=>'','labelOptions'=>array('label'=>'Repita la Clave Nueva'))); ?>
</fieldset>
<div class="form-actions">
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Guardar')); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Borrar')); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
Also we have the corresponding actions in UserController, actionUpdatePassword and actionUpdateEmail.
My problem is that I don’t know how to call the right action inside actionUpdate after the user clicked on ‘Submit’.
How can I get this to work? Am I clear enough?
Thanks in advance.