I have CjuiTab with 3 tabs. In each tab i want to make a registration of different users.
Here is the action which calls CJuitab view
public function actionRunIt(){
$this->render("view");
}
Then view code:
<?php
$this->widget('zii.widgets.jui.CJuiTabs',array(
'tabs'=>array(
'Register patient' => array('ajax' => $this->createUrl('Site/Register')),
'Register patient' => array('ajax' => $this->createUrl('Site/Register')),
'Register moderator' => array('ajax' => $this->createUrl('Site/Contact')),
),
// additional javascript options for the tabs plugin
'options'=>array(
'collapsible'=>true,
),
'id'=>'MyTab-Menu',
));?>
Then Register action(first tap option):
public function actionRegister(){
$model = new Users();
if (!empty($_POST['Users'])) {
$model->attributes=$_POST['Users'];
$model->role=$_POST['RoleList'];
if($model->validate('admin1')) {
if ($model->model()->count("email = :email", array(':email' => $model->email))) {
$model->addError('email', 'email');
$this->renderPartial("admin1", array('model' => $model));
}
if ($model->model()->count("IIN = :IIN", array(':IIN' => $model->email))) {
$model->addError('IIN', 'IIN');
$this->renderPartial("admin1", array('model' => $model));
}
else {
$model->save();
$this->createLogin($model->user_id,$model->email);
}
} else {
$this->renderPartial("admin1", array('model' => $model));
}
}
else {
$this->renderPartial("admin1", array('model' => $model));
}
}
register view
<?php
/* @var $this SiteController */
/* @var $model usernameForm */
/* @var $form CActiveForm */
$this->pageTitle=Yii::app()->name . 'Register user';
$this->breadcrumbs;
?>
<h1>Register user</h1>
<p>Please fill out the following form with new users information:</p>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'register-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php echo $form->labelEx($model,'last_name'); ?>
<?php echo $form->textField($model,'last_name'); ?>
<?php echo $form->error($model,'last_name'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'first_name'); ?>
<?php echo $form->textField($model,'first_name'); ?>
<?php echo $form->error($model,'first_name'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'patronymic'); ?>
<?php echo $form->textField($model,'patronymic'); ?>
<?php echo $form->error($model,'patronymic'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'IIN'); ?>
<?php echo $form->textField($model,'IIN'); ?>
<?php echo $form->error($model,'IIN'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'role'); ?>
<?php $list=array('Patient'=>'Patient','Doctor'=>'Doctor','Moderator'=>'Moderator');
echo CHtml::dropDownList('RoleList', $model,$list,array('empty' => 'Select role'))?>
<?php echo $form->error($model,'role'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'email'); ?>
<?php echo $form->textField($model,'email'); ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'address'); ?>
<?php echo $form->textField($model,'address'); ?>
<?php echo $form->error($model,'address'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Register'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
Cannot understand how can i make a connnection between them.
Now it works like that : If I click button register, then it opens on new window(i know it’s because of renderpartial)
How to make it like registration view loads in juitabs view