Hi,
First of all: Grocery CRUD is amazing, and deserves every nice word.
I have a problem. When I click "Save" and something is selected in some ENUM attribute, I want to be redirected to another site than the standard route. How can I do that?
Here is my code:
public function live()
{
$crud = new grocery_CRUD();
$crud->set_table('live')
->set_subject('event')
->columns('matchID', 'event', 'minute', 'description')
->field_type('event', 'enum', array('Goal', 'Chance', 'Yellow Card', 'Red Card', 'Info'));
$crud->required_fields('matchID', 'date', 'event', 'minute', 'description');
$crud->set_relation('matchID','matches','{hometeam} - {awayteam}', null, 'id DESC');
$crud->callback_after_insert(array($this, 'redirect_user'));
$output = $crud->render();
}
And here is my callback:
function redirect_user($row)
{
if ($row->event === 'Goal')
{
$crud->set_lang_string('insert_success_message',
'Your data has been successfully stored into the database.<br/>Please wait while you are redirecting to the list page.
<script type="text/javascript">
window.location = base_url + "admin/goals/add";
</script>
<div style="display:none">
'
);
}
}
Am I on the track, or is there another way for doing this?
