Hi,
after the removal of a record I would like to initiate a redirect depending on the deleted record. How do I get a reference to the deleted record in actions/delete.php?
Cheers, Christian
reference to deleteted record in actions/delete
8 posts
• Page 1 of 1
reference to deleteted record in actions/deleteHi,
after the removal of a record I would like to initiate a redirect depending on the deleted record. How do I get a reference to the deleted record in actions/delete.php? Cheers, Christian
Hi Christian,
Sorry for the delay in reply. In the current release you need to take this in 2 steps. 1. Use the afterDelete() trigger to store the deleted record in a global variable. 2. Use the action_after_delete() trigger, to perform your redirect. e.g.
The reason we don't put this redirect in the afterDelete() trigger is that the afterDelete() trigger may be used within a function call to delete records... best not to do redirects here. -Steve
Hi Steve,
thank you for the reply. I'm having problems though. The action_after_delete function seems not be called and it isn't mentioned in the docs by the way, at least not here: http://framework.weblite.ca/documentati ... n_triggers Cheers, Christian
Sorry.. forgot that that trigger wasn't introduced in the current release... dev version has it.
You can add this trigger by making the following change to the actions/delete.php file: Find the section that says:
change it to:
Thanks Steve.
Playing around with the other action triggers I noticed that the code in action_after_xxx function is executed before the redirection in actions/new actions/new_related is initiated. Consequently, putting redirection commands in the delegate class's action_after_xxx is useless. Looking at your code
it seems that it might be necessary to move the redirection code one line up. Christian
On the contrary, this positioning allows you to redirect to whatever page you want *before* it gets to the default redirect. If you redirect, then the script never reaches the default redirect. If you don't redirect, it just passes to the default redirect. This technique can be used to add quite complex flow control to your applications. Sometimes I'll pass GET parameters to the form for the purpose of telling my after_action_xxx method where to redirect on success.
8 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 15 guests |