Jump to content

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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
 

Share this post


Link to post
Share on other sites

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",
        } 
   };

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...