YiiFramework field validation

1

I'm starting in Yii Framework. I have created the following database: Table Contact: code, name, address, city, neighborhood, state;
Phone Table: code, phone, idcontato .

When you click save, it does the validation only in the fields of the contact table, how would it display the error message in the phone field?

    
asked by anonymous 15.07.2014 / 15:52

2 answers

1

Apparently your model is not validating the phone field.

Make sure that in the rules() method of your model there is the validation rule for the phone field. It would look something like this:

array('telefone', 'required'),

So it will be validated as required.

In this link is the list of Yii standard validators: link

    
15.08.2014 / 14:59
1

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

$form->errorSummary(array($modelContato, $modelTelefone));
    
02.08.2014 / 17:04