⚠ In case you've missed it we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠


more than one callback ?

callback

  • Please log in to reply
1 reply to this topic

#1 richb201

richb201

    Advanced Member

  • Members
  • PipPipPip
  • 69 posts

Posted 23 July 2020 - 01:51 PM

Can I use $crud->callback_before_insert() and $crud->callback_after_upload() in the same CRUD function in the controller? How about two calls such as 

 $crud->callback_before_insert(a) 

 $crud->callback_before_insert(g)

??

 

 

 

 



#2 richb201

richb201

    Advanced Member

  • Members
  • PipPipPip
  • 69 posts

Posted 23 July 2020 - 07:59 PM

The reason that I am asking is that I am having trouble with call backs and I am not sure what the problem is. I have  callback 

$crud->callback_after_insert(array($this, 'add_email'));

 

here is add email:

function add_email($post_array)
{
$post_array['email'] = $this->session->userdata('userid');
$post_array['campaign'] = $this->session->userdata('campaign');

return $post_array;

}

 

The problem is that unless the field email and the field campaign display in the add form, they don't appear in the post array. Thus if I have made them invisible in the add form like this:

$crud->change_field_type('email', 'invisible');
$crud->change_field_type('campaign', 'invisible');

 

They don't appear in the $post_array  and I can't change them. 







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users