CodeIgniter-MY_Model icon indicating copy to clipboard operation
CodeIgniter-MY_Model copied to clipboard

Handle a form validation error in observers(before_*) functions?

Open emrahoruc opened this issue 9 years ago • 1 comments

Hi,

Question is how can i handle/declare an error in before_create function then skip inserting database and return to the form without loosing $post data?

Thanks.

emrahoruc avatar May 17 '16 22:05 emrahoruc

Maybe we need to add FALSE control like below(?). This solves my problem for going to the form without losing post data at least.

418: $data = $this->trigger('before_create',$data); if($data !== FALSE && $this->_database->insert($this->table, $data))

Also for other observers?

emrahoruc avatar May 17 '16 23:05 emrahoruc