My application displays entreprise information with the following text to hide the real phone number: "*** Primary Phone ". When the user clicks on " Primary Phone ***" I use the CHtml::ajaxLink to call an ajax function that writes in a log table and displays the primary phone # on the screen.
The application is behaving as expected when commenting the $lc->save(false) line…nothing gets written to the table.
Then, I uncommented the save method and commented the code in the case statement. The phone number didn’t get displayed on the screen and the table got written twice.
The Enterprise::model()->getPhone() only reads the phone number from my Entreprise table:
public function getPhone($ent) {
$rec = Entreprise::model()->findByPk($ent);
return $rec['phone_primary'];
}
Since I am still trying to get my head around calling an Ajax function I kept my code very simple. I could be wrong but I don’t think the problem is directly related my code. It’s probably related to the environment like a flag that I didn’t set properly or something missing either in my controller, model or in my ajax function. I hope this make sens!!