Problem With Create Controller

Hi All

I am stucked in a strange problem . I have a controller with a create action. The controller is written below

public function actionCreate(){

    $model=new Division();





    if(isset($_POST['Division'])){


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


         if($model->save()){


               $this->redirect(array('admin'));


          }


    }


   $this->render('create',array(


      'model'=>$model,


   ));


}

Now the problem is that the values that I am submitting in the form are getting submitted two times ie there are two same entries in the database every time.

I have done these types of things many a times and never faced any problem but this thing is making me mad now…

Kindly Help

Regards

how are you doing the submit of the form ?

the controller code looks fine and should work normally

You deleted the ajax validate.

If in your form you use ajax validation, you have to keep this line in the controller:


$this->performAjaxValidation($model);

If you don’t want ajax validation, remove it from the form.