Friendly Errors?

Hi,

Is there a way i can set the system to show friendly errors?

I did a test where two uses enter the same Lead ID (which is a Unique field in the MySQL DB) and I get the following error when adding a lead with a duplicate Lead ID.

Id rather it validate the form on submit, pick a new number and insert that automatically, and the validation error will say its already in use and thats it’s been changed automatically etc etc …

[color="#FF0000"][i]CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘7662’ for key 2. The SQL statement executed was: INSERT INTO leads…[/i][/color]

You can use CUniqueValidator for it.

http://www.yiiframework.com/doc/guide/1.1/en/form.model#declaring-validation-rules

http://www.yiiframework.com/doc/api/1.1/CUniqueValidator

Thanks i’ll take a look.

p