I have the following input fields in one of the edit forms:
<?php
echo $this->Form->input('customer_nr');
echo $this->Form->input('name',array('id'=>'customer_name'));
echo $this->Form->input('phone');
echo $this->Form->input('email');
?>
In the controller I just check if the request is post/put and save that single row.
What I want to do is to capture which fields have been changed. That is needed for giving different flash messages.
I have been through cake php documentation, but did not find any behaviour for this issue.
Any help or guidance is much appreciated.
If you need to check, if data from form and from database are different, then:
$data = $this->ModelName->findById($id);
if($this->request->data != $data){
//array was changed
}
If you need to know, which array key is different, then:
$data = $this->ModelName->findById($id);
$data = $this->ModelName->findById($id);
$difference = array_diff($data, $this->request->data)
Is that what you need?