When creating a new record, I noticed the new record is duplicated (usually 3x but sometimes 4x, 5x…) It took me a while to realize this is caused by AJAX validation.
There are 2 things needed to be done from the code generated by Gii, if you want AJAX validation.
In the view file, set enableAjaxValidation property to true.
In the controller file, locate actionCreate(). you will notice the following 2 lines from the code generated by Gii:
// Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model);
Yes, just follow this instruction. uncomment it.