[b]The Plan:[/b] Base on the documentation, I'm going to use the callback_before_update() function. The function runs before the auto update of the crud. Because of too many long line of codes I have then truncated (...)
$crud= new grocery_CRUD();
$crud->set_table('charter')
->set_subject('Charter')
->set_relation('operator_id','operators','short_name',array('disabled_id'=>'0'))
...
->order_by('charter.created_date','desc');
$crud->display_as('charter_id','Charter ID')
->display_as('charter_title','Test Charter')
->display_as('created_date','Date of Request')
->display_as('operator_id','Requester')
...
->display_as('configuration_requirements','Configuration Requirements');
$crud->columns('charter_code','charter_title',...');
$crud->add_fields('charter_title','testing_type_id',...');
$crud->edit_fields('charter_title','testing_type_id',...');
$crud->required_fields('charter_title','testing_type_id',...');
$crud->callback_before_update(array($this, '_perform_module_before_update'));
$crud->callback_after_insert(array($this, '_perform_module_after_insert'));
$crud->callback_after_update(array($this, '_perform_module_after_update'));
$crud->callback_edit_field('operator_id',array($this,'_operator_id_edit_field'));
$crud->callback_edit_field('comments',array($this,'_comments_edit_field'));
$output = $crud->render();
To test if the callback_before_update fires I here the function. And I am expecting to have a cookie with value from one of the fields.
[indent=1]
[/indent]
function _perform_module_before_update($post_array)
{
set_cookie(array('name' => 'charter_title','value' => $post_array['charter_title']));
}
[b]The Issue:[/b] As I am expecting a cookie to be created but there is none. It seems the callback_before_update didn't fired. Is there something I missed? or Is it wrong approach for this scenario? I'm open for any advice on how I'm going to work on this scenario.
Thanks and BR,
Clustersblue