Yii Framework Forum

Creating a simple Action and Store Data via Active Form


(Info) #1

Hi there i am new and i have for you a simple Question about Yii 1.1.16

I have a view with one datetime field

<?php echo $form->dateTimeLocalField($model, 'verifizierungAufschub'); ?>

i have a action

public function actionAufschub($id)
{
    $model=$this->loadModel($id);

  if(isset($model->verifizierungAufschub))
    if ($model->update()) {

        $this->redirect(array('site/index'));
    }

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

}

the model is correct in default actions/views i can edit the attribut.

but with my custom action, nothng will be stored… can you please help me? that would be great!


(tri - Tommy Riboe) #2

Possible validation error
https://www.yiiframework.com/doc/api/1.1/CActiveRecord#update-detail


(Info) #3

Thank you for your reply, but in my case, i forgott collect the inputs

if(isset($_POST[‘Termin’]))
{
// collects user input data
$model->attributes=$_POST[‘Termin’];
// validates user input and redirect to previous page if validated
if($model->save())
$this->redirect(array(‘site/index’));
}

more and more i like Yii! :slight_smile: