understanding validation and error handling


I wanted to use the unique validator alias to check if a table column value already exists. So I added the validator to the "rules" function.

This seems to work, but what is the correct way (and places in code) to show an error message if the column attribute does already exist (I have no message at all, and I guess there should be a default message for that alias?). I guess I have some understanding problems.

there is the message.

Maybe you forgot to do $form->error($model, ‘attribute’);?