row248
row248

Reputation: 119

Yii form and values of inputs

Im try working with Yii framework. I have 5 inputs like this

<div class="field">
    <?php echo $form->label($model, 'name') ?>
    <?php echo $form->textField($model, 'name'); ?>
    <?php echo $form->error($model, 'name', array('class' => 'label label-important')); ?>
</div>

And this is my rules in model

public function rules() {
    return array(
        array('email, message', 'required', 'message' => 'Заполните поле'),
        array('email', 'email', 'message' => 'Некорректный емаил')
    );

}

If user does not pass validate, all values of inputs delete except email and message. Because i have 'method' required. How me save all values of form without required?

Upvotes: 2

Views: 1004

Answers (1)

user133408
user133408

Reputation:

If you want to have input saved without any rules, you should define it as safe attribute, here is very good article about that: http://www.yiiframework.com/wiki/161/understanding-safe-validation-rules/

Upvotes: 3

Related Questions