Newbie to unigui and javascript,
I am trying to pass variable from a unigui form to javascript.I tried two methods as discussed in forum
First method
on Mainform.oncreate
Self.WebForm.JSInterface.JSAssign('myvar', [2356]);
on same form button1 clientevents(ExtEvents) , I tried to access the variable
function click(sender, e, eOpts)
{
var n1 = MainForm.windows.myvar;
alert(n1);
}
nothing happens.
-----------------
Second method
on Mainform button click
procedure TMainForm.UniButton2Click(Sender: TObject);
begin
UniApplication.UniSession.AddJS('var myVar = 1');
end;
clientside(Extevents)
function click(sender, e, eOpts)
{
var n1 = uniVars.myVar ;
alert(n1);
}
i get undefined alert message at runtime when i click the button.