Goback button doesn't actually go back

softforge

Member
I have turned on the Go Back button but when I click it, nothing happens. I have found the GoBack code in form.js which is the following:

Code:
            goback.addEvent('click', function (e) {
                e.stop();
                if (Fabrik.Windows[this.options.fabrik_window_id]) {
                    Fabrik.Windows[this.options.fabrik_window_id].close();
                }
            }.bind(this));
I have fixed the issue by changing it to the following:

Code:
            goback.addEvent('click', function (e) {
                e.stop();
                if (Fabrik.Windows[this.options.fabrik_window_id]) {
                    Fabrik.Windows[this.options.fabrik_window_id].close();
                } else {
                    window.history.back();
                }
            }.bind(this));
Is there any reason why the Go Back button only closes a popup window? It would seem to make sense to return you to the previous page if not open in a popup window.

I hope this change can make it into Fabrik.
 
OK, I see what happened there. Previously, the Go Back button didn't have the concept of being in a popup, so would attempt to go "back" out of the popup, which doesn't work. So instead, we changed it so "Go Back" from a popup closes the popup. But (ehem) we forgot to handle NOT being in a popup.

One thing before I commit your fix ... can you make sure this works in all browsers, or at least IE, Chrome and FF?

From the look of the code that used to be there, we were originally having to handle IE differently, by setting window.parent.location by hand, rather than using window.history.back().

-- hugh
 
Thanks Hugh.

I have tested this in IE9 (and in IE8 and IE7 using IE9 compatibility mode) and it works fine. I have seen some people say that this has caused problems with IE6 but I guess we don't have to support that as Joomla no longer does.

:)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top