Hello guys I am creating a website with php and Yii framework. Right now I have created a admin module and created crud in this module, but it seems that I can’t create a record. what I have got for now is:
public function actionCreate()
{
$model=new GamesValidator;
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='games-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
if(isset($_POST['GamesForm']))
{
die('GamesForm is set'); // just to see if GamesForm has some value! but website never shows this massege, it shows just new form, which is my problem.
/*
$model->attributes=$_POST['GamesForm'];
if($model->validate()){
echo ('This is only a test');
return;
} else {
echo ('There was some error!');
return;
}
*/
}
$this->render('create',array(
'model'=>$model,
));
}
but it doesn’t show anything, website shows the form.php again like nothing was done at all. here is a little code from my view file:
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'games-form',
'enableAjaxValidation'=>true
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
[..........................]
<div class="row buttons">
<?php echo CHtml::submitButton('Submit'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
sorry I can’t post a full code it is too long.
so can you tell me what can be wrong?