Mlothswwa Posted November 5 Report Share Posted November 5 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...
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.