After 'Save' or 'Create' go to list view page automatically with success message

edited October 2013 in Modules
Currently If i create a new record then i go to edit page and show save message. But i want to go to list view page after create new record and want to show success message. How can i do that. I think for that i have to use on_after_save() and flash_userdata(). I am not sure. if i am correct then what is the flash_userdata() paramiter. Please help me.

Comments

  • edited 10:55AM
    I would use the on_after_post model method. This gets executed only on the edit page so you don't need to worry about redirecting if you were to use the save method outside of the context of the edit page.

    If you are using the FUEL 1.0 beta (https://github.com/daylightstudio/FUEL-CMS/tree/1.0), you can use the Fuel_admin object like so, with one of the following options Fuel_admin::NOTIFICATION_SUCCESS, Fuel_admin::NOTIFICATION_ERROR, Fuel_admin::NOTIFICATION_WARNING, Fuel_admin::NOTIFICATION_INFO:
    function on_after_post($values) { $this->fuel->admin->set_notification($msg, Fuel_admin::NOTIFICATION_SUCCESS); }

    If you are using 0.93, you can use the "success" or "error" or "info"
    function on_after_post($values) { $this->session->set_flashdata('success', 'Your message here'); }
  • edited 10:55AM
    you are realy grate. I have looked for like this answer. I have not try your code till now. But I am sure It Will work. So Many many thanks
Sign In or Register to comment.