eziogrieco Posted March 6, 2014 Report Share Posted March 6, 2014 Hi guys, i need a small help! I'm passing a var data to an html page trough this script: var data = { registry: "[@authfield:registry^]", }; [@authfield:registry^] is a checkbox field, so it returns YES/NO. Now i need a more complex code. I would like to set something that do it: if { ([@authfield:registry^]= Yes & [@authfield:record^]= Yes) registry= Yes} else { registry = No } May somebody help me to fix this code? Thanks in advance Ezio Grieco Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 6, 2014 Report Share Posted March 6, 2014 I need to know more like what is the data page type, what is the condition. The code can be something like: var registery= '[@authfield:registry]'; if ([@authfield:registry]== 'Y' && [@authfield:record]== 'Y') { registry= "Yes"; } else { registry= "Yes"; } but to provide you a more precise answer elaborate more about the data page and the code. Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 6, 2014 Report Share Posted March 6, 2014 If you can also provide the link to the page in here Quote Link to comment Share on other sites More sharing options...
eziogrieco Posted March 6, 2014 Author Report Share Posted March 6, 2014 HI MayMusic, thank you very much for the fast response. This is exactly the code i setted in the footer of the datapage to collect some paramters and use them in my html page: <script type="text/javascript" src="http://minaba.net/assets/scripts/Minaba.js"></script> <script type="text/javascript"> var data = { anagrafiche: "[@authfield:users_list_registry^]", bordero: "[@authfield:users_list_bordero^]", borderoPrevisionale: "[@authfield:users_list_forecast_bordero^]", magazzino: "[@authfield:users_list_warehouse^]", magazzinoPrevisionale: "[@authfield:users_list_forecast_warehouse^]", contabilita: "[@authfield:users_list_accounting^]", contabilitaPrevisionale: "[@authfield:users_list_forecast_accounting^]", report: "[@authfield:users_list_report_manager^]", reportPrevisionale: "[@authfield:users_list_forecast_report_manager^]", admin: "[@authfield:users_list_company_admin^]", }; Minaba.setInfo(data); </script> With this script i collect user permissions and pass them to an html to show or hide some menu areas. It works very good! Now i would like to cross user permissions with company permissions, to avoid user to access to some areas denied to his own company. For this reason i tought a code that run in this way: var data = { if ([@authfield:users_list_registry^]='Y' && [@authfield:companies_list_registry^]='Y') { anagrafiche: "Yes", } else { anagrafiche: "No", } }; And repeat the code for each menu section (bordero, borderoPrevisionale, etc). In this way if the area is allowed to the company and the user, html will show the area, else it will be denied. The point is that this code doesn't work! Any other idea? Thanks in advance Ezio Quote Link to comment Share on other sites More sharing options...
Jan Posted March 7, 2014 Report Share Posted March 7, 2014 Hello Ezio, If you want to compare whether two variables are equal, you should use "==" instead "=" Try to change the code like var data = { if ([@authfield:users_list_registry^]=='Y' && [@authfield:companies_list_registry^]=='Y') { anagrafiche: "Yes", } else { anagrafiche: "No", } }; Quote Link to comment Share on other sites More sharing options...
eziogrieco Posted March 9, 2014 Author Report Share Posted March 9, 2014 Hi guys, thanks for your responses, they was been very helpful! This is the way i founded to solve my needed: <script type="text/javascript" src="http://minaba.net/assets/scripts/Minaba.js"></script> <script type="text/javascript"> var users_list_registry = "[@authfield:users_list_registry^]"; var companies_list_registry = "[@authfield:companies_list_registry^]"; anagrafiche_val = "No", if (users_list_registry =='Yes' && companies_list_registry =='Yes') { anagrafiche_val = "Yes"; } var data = { anagrafiche: anagrafiche_val, }; Minaba.setInfo(data); </script> In this way i obtained to cross 2 params before pass a value. See you next time! Ezio Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 11, 2014 Report Share Posted March 11, 2014 Can you please also let me know why we have ":" instead of "=" in this line anagrafiche: anagrafiche_val Thank you 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.