Ejemplo n.º 1
0
 public function actionNuevo()
 {
     $model = new NewForm();
     if (isset($_POST['NewForm'])) {
         //            $valid = true;
         $model->attributes = $_POST['NewForm'];
         $valid = $model->validate();
         Yii::log('submit -> ' . print_r($_POST, true));
         Yii::log('model->attributes -> ' . print_r($model->attributes, true));
         if ($model->validate()) {
             $model->guardaDatosGenerales();
         } else {
             //                CVarDumper::dump($model->getErrors(),5678,true);
             //                Yii::app()->end();
         }
     }
     $this->render('nuevo', array('model' => $model));
 }
Ejemplo n.º 2
0
 public function actionCreate()
 {
     $model = new NewForm();
     $form = new Form('codegen.NewForm', $model);
     if ($form->submitted() && $model->validate()) {
         self::generateAndSaveForm($model->model);
         Yii::app()->user->setFlash(Controller::MSG_SUCCESS, 'Форма создана!');
         $this->redirect($_SERVER['REQUEST_URI']);
     }
     $this->render('create', array('form' => $form));
 }