ajaxSubmitButton Redirect

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">

&lt;div class=&quot;uiHeader&quot;&gt;


  &lt;h2&gt;&lt;?php echo CHtml::encode(Yii::t('site', 'Sign Up')) ?&gt;&lt;/h2&gt;


&lt;/div&gt;


&lt;div class=&quot;signupcontainer form&quot;&gt;


  &lt;?php &#036;form=&#036;this-&gt;beginWidget('CActiveForm', array(


    'id'=&gt;'signupform',


    'enableAjaxValidation'=&gt;true,


  )); ?&gt;


  &lt;?php echo &#036;form-&gt;errorSummary(&#036;model); ?&gt;


  &lt;div class=&quot;row clear&quot;&gt;


    &lt;?php echo &#036;form-&gt;labelex(&#036;model,'firstname'); ?&gt;


    &lt;?php echo &#036;form-&gt;textfield(&#036;model,'firstname') ?&gt;


  &lt;/div&gt;


  &lt;div class=&quot;row clear&quot;&gt;


    &lt;?php echo &#036;form-&gt;labelex(&#036;model,'lastname'); ?&gt;


    &lt;?php echo &#036;form-&gt;textfield(&#036;model,'lastname') ?&gt;


  &lt;/div&gt;


  &lt;div class=&quot;row clear&quot;&gt;


    &lt;?php echo &#036;form-&gt;labelex(&#036;model,'email'); ?&gt;


    &lt;?php echo &#036;form-&gt;textfield(&#036;model,'email') ?&gt;


    &lt;?php echo &#036;form-&gt;error(&#036;model,'email'); ?&gt;


  &lt;/div&gt;


  &lt;div class=&quot;row clear&quot;&gt;


    &lt;?php echo &#036;form-&gt;labelex(&#036;model,'password'); ?&gt;


    &lt;?php echo &#036;form-&gt;passwordfield(&#036;model,'password') ?&gt;


  &lt;/div&gt;


  &lt;div class=&quot;clear&quot;&gt;


    &lt;?php echo CHtml::ajaxSubmitButton(Yii::t('site', 'Sign Up'), &#036;this-&gt;createUrl('site/signup'), array('update'=&gt;'.FullPage_Container'),array('class'=&gt;'btn')); ?&gt;


  &lt;/div&gt;      


  &lt;?php &#036;this-&gt;endWidget(); ?&gt;


&lt;/div&gt;

</div>

<div class="loginlanguage">

&lt;?php &#036;this-&gt;widget('application.components.LangBox') ?&gt;

</div>

</div>[/color]

and this is the code for the controller

[color=&quot;#FF0000&quot;]&#036;model = new User();


if(Yii::app()-&gt;request-&gt;isAjaxRequest)


	{


  if(isset(&#036;_POST['ajax']) &amp;&amp; &#036;_POST['ajax']==='signupform')


  {   


      echo CActiveForm::validate(&#036;model);


      Yii::app()-&gt;end();


  }      


  &#036;model-&gt;attributes = &#036;_POST['User'];


  


  if (&#036;model-&gt;validate())


  {


    &#036;model-&gt;save();





    &#036;this-&gt;redirect(&#036;this-&gt;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

Hi butching,

First of all, please don’t forget to use code warppers (<> sign) when sending your code :)

About your question, please take a look here: ajax-details, hope it’ll help.