huge icon indicating copy to clipboard operation
huge copied to clipboard

No feedback message with redirect?

Open mrgreen222 opened this issue 10 years ago • 5 comments

Hi!

Im trying to send feedback togheter with a feedback message, like this:

    if($theaters->length == 1){
        foreach($theaters as $value){
            $theatername = $value->nodeValue;
        }
        Session::add('feedback_positive', 'Just one');
        Redirect::to('index/timeofday/');
        return false;
    }      

But I'm being redirected without a feedback message.

Is this not the way to use feedback messages?

mrgreen222 avatar Jan 07 '16 16:01 mrgreen222

Check for this line in your application/view/your_dir/your_file.php

<?php $this->renderFeedbackMessages(); ?>

This must be included somewhere between HTML code Example view file: Click me

slaveek avatar Jan 07 '16 22:01 slaveek

Yes i have that line, but still, no message =)

EDIT: Some extra information, its in a model.

mrgreen222 avatar Jan 11 '16 10:01 mrgreen222

Hi, you can find the definition of this method here: https://github.com/panique/huge/blob/master/application/core/View.php#L87

Maybe you're missing something or have deleted the _templates/feedback.php or so.

panique avatar Jan 11 '16 10:01 panique

Try to logout then login again but type wrong password. See whether feedback working or not at all.

slaveek avatar Jan 11 '16 11:01 slaveek

Yes feedback messages are working otherwise, just don't in this case =)

This is my flow, it seems as the feedback message is viewed and unset before it is display on "correct" view.

IndexController/firstpage

    public function firstpage($city)
    {
        $this->View->render('index/firstpage', array('dates' => IndexModel::city($city));                       
    }

User clicks a link on first page that refers to IndexController/secondpage

    public function secondpage($city, $location)
    {
        $this->View->render('index/secondpage', array('dates' => IndexModel::city_and_location($city, $location));                       
    }

And in IndexModel/city_and_location

        if($location == 'home'){
            Session::add('feedback_negative', '(No second page, straight to third page)');
            Redirect::to('index/thirdpage' . $location);
            return false;
        }

And thirtpage

    public function thirdpage($city, $location)
    {
        $this->View->render('index/secondpage', array('dates' => IndexModel::your_home($city, $location));                       
    }

So flow is that the second page can be omitted, if $location true. But if I force and error into IndexController/secondpage $location, second page will display the message (with errors).

Hope this gives some clarity to the issue, and if someone can try to reproduce and see what the results are =)

(I have excluded some unnecessary code, so maybe a parentheses are wrong, but my code is otherwise legit)

mrgreen222 avatar Jan 11 '16 14:01 mrgreen222