Can we access to user level from javascript client event?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
amiens80
User
Posts: 450

Can we access to user level from javascript client event?

Post by amiens80 »

hi,

in my event client side, i need to add a specific behavior depending of the user level.

is there a javascript variable which already store the user level value ? a variable i could use in the client Startup script ?

in the exemple and the documentation, you put a value of 2 for Manager.
in javascript, how can i get access to that value ?

Best regards


mobhar
User
Posts: 11700

Post by mobhar »

You may simply use SetClientVar() global function to set a client variable from server-side.

Search in this forum for SetClientVar for more info and examples. See also the documentation of Some Global Functions


amiens80
User
Posts: 450

Post by amiens80 »

thank you a lot.

so, i my server event function Page_Rendering() , i added :

$user_level = CurrentUserLevel();
SetClientVar("My_JS_Var", $user_level);

and client side, in my loadjs.ready("load", function() (startup script) , i can access to it with :

alert(ew.vars.My_JS_Var);

Solved !
have a good day.


vintoICT
User
Posts: 403

Post by vintoICT »

great!


Post Reply