Problems with forms

Hi all,

I am fairly new to YII and I was hoping to get some help figuring out why my site controller is not detecting a post that is being processed in the view. I inserted

if($_POST)

 echo "it works"

in the view and that does echo once the submit button is pressed. Any thoughts?



                                                   siteController code   (siteController.php)


    public function actionIntermediatelogin()


    {


        $model = new IntermediateLoginForm;


        if(isset($_POST['IntermediateLoginForm']))


        {


            if($model->validate())


            {


                $this->layout = "SROMain";


                $this->render('SROindex'); 


            }


        }


    }


                                      my form model  (IntermediateLoginForm.php)


class IntermediateLoginForm extends CFormModel

{

public $continue;


    public $role;


    public $relationship;








public function rules()


{


	return array(


		array('role, relationship', 'required'),


	);


}





/**


 * Declares attribute labels.


 */


public function attributeLabels()


{


	return array(


		'continue'=>'continue',


	);


}





public function authenticate($attribute,$params)


{


	if(!$this->hasErrors())


	{


                $this->addError('relationship','You must select a role and relationship to continue');


	}


}

}



                                                            my view (IntermediateLogin.php)


<div class="form">

<?php $form=$this->beginWidget(‘CActiveForm’, array(

'id'=&gt;'IntermediateLoginForm-form',


'enableClientValidation'=&gt;true,


'clientOptions'=&gt;array(


	'validateOnSubmit'=&gt;true,


),

)); ?>

<h1>Welcome Person </h1>

<h1>This is an intermediate login page</h1>

<? //allow the user to select their role ?>

<p>select your role</p>

<select name="roles" size="1">

&lt;option&gt;Choose a role&lt;/option&gt;


&lt;option&gt;role1&lt;/option&gt;


&lt;option&gt;role2&lt;/option&gt;

</select>

<br/><br/>

<p>Select Relationship</p>

<select name="relationshipName" size="1">

&lt;option&gt;Choose a relationship&lt;/option&gt;


&lt;option&gt;relat1&lt;/option&gt;


&lt;option&gt;relat2&lt;/option&gt;

</select>

<div class="row buttons">

	&lt;?php echo CHtml::submitButton('Submit'); ?&gt;


&lt;/div&gt;

<?php $this->endWidget(); ?>

<?php

if($_POST)

{

echo &quot;it works&quot;;

}

?>

sorry, i re read it and i might not be as clear as Id hoped.

The problem is the redirect on the site controller is never executing. Any ideas why that may be?

could you please use code tags or pastebin the code, it is really hard to read and therefor almost impossible to provide help





/*---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

              siteController code (siteController.php) snippet

---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------*/

     public function actionIntermediatelogin()

     {

        $model = new IntermediateLoginForm;

        if(isset($_POST['IntermediateLoginForm']))

        {

            if($model->validate())

            {

              $this->layout = "SROMain";

              $this->render('SROindex'); 

            }

        }

     }


/*---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

                   my form model (IntermediateLoginForm.php)

---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------*/

class IntermediateLoginForm extends CFormModel

{

     public $continue;

     public $role;

     public $relationship;




     public function rules()

     {

         return array(

         array('role, relationship', 'required'),

                 );

      }




     public function attributeLabels()

     {

      return array(

                         'continue'=>'continue',

                         );

     }


     public function authenticate($attribute,$params)

     {

          if(!$this->hasErrors())

          {

                $this->addError('relationship','You must select a role and relationship to continue');

          }

      }


}

/*---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------

             my view (IntermediateLogin.php) snippet

---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------*/


        <div class="form">

        <?php $form=$this->beginWidget('CActiveForm', array(

                                                     'id'=>'IntermediateLoginForm-form',

                                                      'enableClientValidation'=>true,

                                                    'clientOptions'=>array(

                                                      'validateOnSubmit'=>true,

                                                      ),

                                                      )); ?>


          <h1>Welcome Person </h1>

          <h1>This is an intermediate login page</h1>




          <? //allow the user to select their role ?>

          <p>select your role</p>

          <select name="roles" size="1">

             <option>Choose a role</option>

             <option>role1</option>

             <option>role2</option>

          </select>


<br/><br/>


         <p>Select Relationship</p>

         <select name="relationshipName" size="1">

             <option>Choose a relationship</option>

             <option>relat1</option>

             <option>relat2</option>

         </select>




          <div class="row buttons">

              <?php echo CHtml::submitButton('Submit'); ?>

          </div>


       <?php $this->endWidget(); ?>

       <?php

            if($_POST)

            { 

              echo "it works";

            }

       ?>



Hello all,

After a lot of reviewing I realized that the post was being handled in the actionIndex function of my siteController.php