hendrang Posted September 6, 2012 Share Posted September 6, 2012 Hi All, Please help. I am newbie in Web Application I want the ClientEvent OnClick Execute ajaxRequest with EventName depend on an variable value declare in MainForm For example : Salary is variable declare in MainForm function OnClick(sender, e) { if (Salary < 10000) { ajaxRequest(sender, 'Event1'); } else { ajaxRequest(sender, 'Event2'); } } Please help me to correct the function above. Thanks in advance. Link to comment Share on other sites More sharing options...
zilav Posted September 6, 2012 Share Posted September 6, 2012 The easiest (but not the best) way is to create a hidden unilabel and store variable in its caption so you can access it in client browser. The right way is to create your own "namespace" in javascript globals and store variables there with UniSession.AddJS(), something like this window.MyVars = window.MyVars || {}; window.MyVars.Salary = 1000; ... function OnClick(sender, e) { if window.MyVars.Salary < 10000 then ... Link to comment Share on other sites More sharing options...
hendrang Posted September 6, 2012 Author Share Posted September 6, 2012 The easiest (but not the best) way is to create a hidden unilabel and store variable in its caption so you can access it in client browser. The right way is to create your own "namespace" in javascript globals and store variables there with UniSession.AddJS(), something like this window.MyVars = window.MyVars || {}; window.MyVars.Salary = 1000; ... function OnClick(sender, e) { if window.MyVars.Salary < 10000 then ... Hi. Thanks for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now