hendrang Posted September 6, 2012 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. Quote
zilav Posted September 6, 2012 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 ... Quote
hendrang Posted September 6, 2012 Author 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. Quote
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.