Joomla 2.5 method save() -


is there way show changed values after saving within joomla save method? example, when edit "maxuser" field , save it, i´d show old , new value. tried comparing "getvar" , "$post", both values same.

function save() {  ...  $maxuser1 = jrequest::getvar('maxuser'); $maxuser2 = $post['maxuser'];  ... if($maxuser1 != $maxuser2) {     $msg = "not same ..."; }  ...  } 

it's better override jtable, not model. heres sample code:

public function store($updatenulls = false) {   $oldtable = jtable::getinstance(table_name, instance_name);   $messages = array();   if ($oldtable->load($this->id)) {             // can compare values $oldtable->param old, , $this->param new     // example     if ($oldtable->title != $this->title) {       $messages[] = "title has changed";     }   }    $result = parent::store($updatenulls);    if ((count($messages) > 0) && ($result === true)){     $message = implode("\n", $messages);     return $message;   } else {     return $result;   }     } 

this return message string if there any, true if there no messages , save succeeded , false if saving failed. have check returned value in model , set right redirect message.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -