tab:messages constant redirect - SOLVED (solution posted)

When I try to view all messages by going to the url /home/index/tab:messages, the ajax is constantly redirecting in the background. How do I find the offending script?  How exactly does the tab:<function> work?

Thanks in advance for any help, I'm pulling my hair out on this one!
Reid Cardwell Basic on 03/01/17 at 15:51 in Other
3 Answer(s)
on desktop or mobile.. because on mobile it seems to work okay (sorry Im not at a desktop at the moment)
ketkew Bronze badges on 03/01/17 at 15:55
Desktop. I'm making modifications, so I've obviously broken something. I'm trying to determine how the /home/index/tab:<function> works so I can track it down. Thanks!
Reid Cardwell Basic on 03/01/17 at 15:59
For anyone else who has this issue, to save you much time trying to find it, here's what happened. I had removed the Messages button in my template which removed the element with the id "messages".  The javascript function initHomeTabs located in app/webroot/js/moocoore/tab.js Looks for the element with the id of "messages" and grabs the needed url from the data-url element.  So when going to /home/index/tab:messages the id "messages" is not found since the button was removed. That's the first issue.

The second issue is that the initHomeTabs function redirects to the same url (/home/index/tab:messages) if it doesn't find an element named "messages", so what you end up with is a constant redirect in the background while the screen simply shows "Loading" in the area where the messages section should be.
 
This will happen with any element with the id of X where X is the portion after tab in the URL structured as /home/index/tab:X .
 
I have implemented a fix naming another element "messages", but for anyone developing their own template, this is a pretty serious flaw.
Reid Cardwell Basic on 03/02/17 at 11:58 Edited
Cookies on mooCommunity - Social Networking Script.
This site uses cookies to store your information on your computer.