i have two actions to do after submit
- Single Page
Posted 01 November 2011 - 11:40 AM
i use grocerycrud 1.1.3,
i want to do two actions in after submit.
1- update table
2- add new ligne in table_histo.
note: i can do this with trigger (in database) , but i want to do this in my code.
how can i do this.
thank you
Posted 01 November 2011 - 19:14 PM
hi,
i use grocerycrud 1.1.3,
i want to do two actions in after submit.
1- update table
2- add new ligne in table_histo.
note: i can do this with trigger (in database) , but i want to do this in my code.
how can i do this.
thank you
[/quote]
You have to use callback_after_insert ( http://www.grocerycrud.com/crud/function_name/callback_after_insert ) and callback_after_update ( http://www.grocerycrud.com/crud/function_name/callback_after_update ) . I don't have examples for this in the website but it works with the same way as callback_before_insert . I have an example for this at: http://www.grocerycrud.com/crud/example/callback_before_insert . The only difference is that you will have two parameters in your callback the one is the post array and the other is the primary key. So your callback will be something like this
function example_callback($post_array, $primary_key_value)
{
//Your trigger goes here
}
If you have any issues or any problem with this just ask.
Posted 02 November 2011 - 14:48 PM
i will try to use this
Posted 03 November 2011 - 15:52 PM
i didn't success to do this.
can you please write an example.
for me i have two tables[b] file_base[/b] and[b] file_base_archive [/b], for (update) on one row of table[b] file_base[/b] i will add one row in [b]file_base_archive [/b]wich contain the old values of row updated and also the date of updating.
and for delete i will put the ligne deleted from [b]file_base[/b] in [b]file_base_archive.[/b]
[b]i think the probleme is clear [/b].
thank you in advance
Posted 13 April 2012 - 15:26 PM
I added to the post_array an extra value to be added in the query and.. nothing happend and even I return an empty array and nothing.. it just added from the
data in the form
Posted 13 April 2012 - 21:36 PM
You can also find many intrestring things at the forum "How to and FAQ": http://www.grocerycr...ow-to-and-faqs/