Hi,
Im using CHtml::ajaxSubmitButton Im just wondering if there’s a way to redirect the page if there’s no error?
I dont used modal for this one… I used the main page.
here is my code for the form
[color="#0000FF"]<div class="FullPage_Container">
<div class="signupform">
<div class="uiHeader">
<h2><?php echo CHtml::encode(Yii::t('site', 'Sign Up')) ?></h2>
</div>
<div class="signupcontainer form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'signupform',
'enableAjaxValidation'=>true,
)); ?>
<?php echo $form->errorSummary($model); ?>
<div class="row clear">
<?php echo $form->labelex($model,'firstname'); ?>
<?php echo $form->textfield($model,'firstname') ?>
</div>
<div class="row clear">
<?php echo $form->labelex($model,'lastname'); ?>
<?php echo $form->textfield($model,'lastname') ?>
</div>
<div class="row clear">
<?php echo $form->labelex($model,'email'); ?>
<?php echo $form->textfield($model,'email') ?>
<?php echo $form->error($model,'email'); ?>
</div>
<div class="row clear">
<?php echo $form->labelex($model,'password'); ?>
<?php echo $form->passwordfield($model,'password') ?>
</div>
<div class="clear">
<?php echo CHtml::ajaxSubmitButton(Yii::t('site', 'Sign Up'), $this->createUrl('site/signup'), array('update'=>'.FullPage_Container'),array('class'=>'btn')); ?>
</div>
<?php $this->endWidget(); ?>
</div>
</div>
<div class="loginlanguage">
<?php $this->widget('application.components.LangBox') ?>
</div>
</div>[/color]
and this is the code for the controller
[color="#FF0000"]$model = new User();
if(Yii::app()->request->isAjaxRequest)
{
if(isset($_POST['ajax']) && $_POST['ajax']==='signupform')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
$model->attributes = $_POST['User'];
if ($model->validate())
{
$model->save();
$this->redirect($this->createUrl('site/home'));
}
$this->renderPartial(’_signup’,array(‘model’=>$model));
} [/color]
The problem is it only redirects the part of a page which is <div class="FullPage_Container">
Thanks