Mlothswwa Posted November 5, 2023 Report Share Posted November 5, 2023 Hi, Am wanting to create dynamic menus based on user roles. Found an example from the Caspio forum. This example is not working for me. For some reason it's not getting to execute the IF statement. If I add display statements before and after the IF statement, they run properly. May I be advised as to why the IF statement on the below example is not working. Please advise. <div id="menu"></div> <script> document.addEventListener('DataPageReady', function (event) { if("[@authfield:Role]" == "Admin"){ document.getElementById('menu').innerHTML = '[@app:Admin]'; } else if ("[@authfield:Role]" == "Agent"){ document.getElementById('menu').innerHTML = '[@app:Agent]'; } }); </script> Quote Link to comment Share on other sites More sharing options...
eallison Posted February 3 Report Share Posted February 3 I have the same question. I have been searching for a solution to role based menus for a few months. Quote Link to comment Share on other sites More sharing options...
Volomeister Posted February 5 Report Share Posted February 5 Hi @eallison, @Mlothswwa Could you share a link to the Deployed DataPage where you implemented this solution so I can check? Quote Link to comment Share on other sites More sharing options...
PotatoMato Posted March 14 Report Share Posted March 14 Hi! Just to update, Caspio has an article about custom navigation menu based on user role: https://howto.caspio.com/tech-tips-and-articles/customizing-navigation-menu-based-on-user-roles/ -Potato Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.