Field validation Yiiframework

Asked

Viewed 387 times

1

I am starting in Yii Framework. I have created the following database:
Contact Table: code, name, address, city, neighborhood, state;
Telephone table: code, phone number, contact.

By clicking save, it does the validation only in the contact table fields, as it would display the error message in the phone field?inserir a descrição da imagem aqui

2 answers

1


Apparently your model is not validating the phone field.

Check if in the method rules() from your model there is the validation rule for the phone field. It would be something like this:

array('telefone', 'required'),

So it will be validated as mandatory.

Here is the list of Yii default validators: http://www.yiiframework.com/wiki/56/

  • Great, solved, thanks!

1

You can pass an array of templates to display errors, for example

$form->errorSummary(array($modelContato, $modelTelefone));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.