⚠ 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 is an archived forum. ⚠

  •     

profile picture

Auto execute add_action



Robert
  • profile picture
  • Member

Posted 14 November 2013 - 07:16 AM

Is there a way to auto execute a "add_action".

 

I wanted to try to make something like :

if ($crud->getState() == 'update')  {
 // execute the custom action i creted
}

Thanks


Robert
  • profile picture
  • Member

Posted 21 November 2013 - 07:07 AM

Anyone had the same problem ?


Amit Shah
  • profile picture
  • Member

Posted 21 November 2013 - 09:42 AM

Hello Robert,

 

I am sorry to say i didnt understand as what exactly you wanted to do .. based on your requirements above asking for add_action and thn giving example of update state.. sorry but am confused as what is your requirement. May be if you can explain better can give you correct solution on the same


Robert
  • profile picture
  • Member

Posted 21 November 2013 - 11:50 AM

Let me try to explain better.

I added a custom action that will send a email based on what info if added to that line when you click it. 

$crud->add_action('Send Email', base_url("assets/img/rep.png"), 'main/send_email', 'ConfirmSend');

public function send_email()  {
    // .......
}

What i want to do is make that process auto so when they finis adding something to a line to auto run the function. That is the reason i wanted to use 

$crud->getState()

Amit Shah
  • profile picture
  • Member

Posted 22 November 2013 - 07:52 AM

Well Robert .., let me get it cleared again .. what you say is.. if you added to a line .. anything.. irespective of whether u clicked on update / add button ... when the cursor is out of the field .. you want to shoot the email ...

if that is the case  -u will need to deal the same with ajax work...

if not.. u want to perform the action on add / update..

i will rather recommend u use callback_before/after_update/insert - whtever is your criteria

This is a mechanism of automatically calling such functions for specific events.

 

Happy GCing


Robert
  • profile picture
  • Member

Posted 22 November 2013 - 13:36 PM

Thanks a loot forgot about callback_before/after_update/insert  :wacko: