User Registration

Guys

Please help, I am not able to submit my form variables and save it to database + there is no validation happening :(

Registration Model




class registerForm extends CFormModel

{

        public $username;

        public $password;

        public $email;


        private $_identity;


        /**

         * Declares the validation rules.

         * The rules state that username, password & email are required,

         * and username & email needs to be unique.

         */

        public function rules()

        {

                return array(

                        // username and password are required

                        array('username, password, email', 'required','message'=>'Required!'),

                        // make sure username and email are unique

            array('username, email', 'unique'),

                );

        }


        /**

         * Declares attribute labels.

         */

        public function attributeLabels()

        {

                return array(

                        'username'=>'Username',

                        'email'=>'Email Adress',

                        'Password'=>'Password',

                );

        }

}




CONTROLLER




public function actionRegister()

		{

			$model=new RegisterForm;

			$newUser = new TblUser;


                // if it is ajax validation request

			// if(isset($_POST['ajax']) && $_POST['ajax']==='verticalForm')

			// {

			// 	echo CActiveForm::validate($model);

			// 	Yii::app()->end();

			// }


				//echo $_POST['RegisterForm'];

                // collect user input data

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

			{

			


			$model->attributes=$_POST['RegisterForm'];

			

			if ($model->validate()) 

			{

					$newUser->Username = $model->username;

					$newUser->Password = $model->password;

					$newUser->Email = $model->email;

                    


					if($newUser->save()) 

								{

						$identity=new UserIdentity($newUser->Username,$model->Password);

						$identity->authenticate();

						Yii::app()->user->login($identity,0);

                                

						$this->redirect(Yii::app()->user->returnUrl);

								}

			}


			}

			

				$this->render('Register',array('model'=>$model));

			

                // display the register form

			

		}



VIEW





div class="form">

<?php echo CHtml::beginForm(); ?>

    <?php echo CHtml::errorSummary($model); ?>

    <div class="row">

        <?php echo CHtml::activeLabel($model,'username'); ?>

        <?php echo CHtml::activeTextField($model,'username') ?>

</div>

    <div class="row">

        <?php echo CHtml::activeLabel($model,'email'); ?>

        <?php echo CHtml::activeTextField($model,'email') ?>

</div>

    <div class="row rememberMe">

        <?php echo CHtml::activeLabel($model,'password'); ?>

        <?php echo CHtml::activePasswordField($model,'password'); ?>

</div>

    <div class="row submit">

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

</div>

<?php echo CHtml::endForm(); ?>




This is Yii2 forum not Yii 1.1

[color="#556B2F"]/* Moved from "Yii 2.0" to "Yii 1.1.x" */[/color]

Try to debug. Which kind of errors do you find? Try to check if actionRegister receives $_POST[‘RegisterForm’].

There is no validation happening in the RegisterForm model, or in TblUser model?