Welcome Guest, Not a member yet? Register   Sign In
What is best way to display confirmation messages
#1

[eluser]welzie[/eluser]
I would like to display confirmation messages to the user after saves, deletes, etc. I haved read through the guide, forum, and wiki, but didn't see any suggested CI solution.

Any suggestions?

P.S. This is my second attempt at posting this, the first attempt failed silently.
#2

[eluser]liamstask[/eluser]
Try using the flashdata in the sessions class. It pops a message into the session for just one request.
#3

[eluser]MadZad[/eluser]
Concur.

I'll typically have a line like this in my controller:
Code:
$this->data["error_message"] = $this->session->flashdata("error_message");
to get the status message from the session, then pass it to my view:
Code:
if (isset($error_message)) {
    echo '<div class="alert_message">' . $error_message . "</div>\n";
}

In the past, I've run into complications when doing redirects - the flashdata wasn't available. In those cases I used a normal session storage (set_userdata) and then done a read-once fetch (write a function that does the read then unset, for convenience).
#4

[eluser]Ebot Ndip-Agbor[/eluser]
take a look at this thread.
#5

[eluser]adamp1[/eluser]
Just saved me a lot of work finding that exact post, thanks Ebot. I would also take a look at this thread. Where my class is just a class and a view file his has style sheets and everything. There almost the same.




Theme © iAndrew 2016 - Forum software by © MyBB