I am attempting to pass a variable to clients side script,edit the value, and return it to server side. To start with, for testing, I did the following in the server side:
If ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML) Then
ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn)
ClientAPI.RegisterClientVariable(Page, "Of", "TestValue", True)
DNNClientAPI.AddBodyOnloadEventHandler(MyBase.Page, "GetURL()")
End If
So this calls function GetURL() on the clientside in the page load server side event. In GetURL() I have:
function GetURL()
{
var sOF = dnn.getVar('Of');
//alert('Value is: ' + sOf);
//perform manipulation on sOf...
//dnn.setVar('r_sOf", sOf);
}
'var sOF = dnn.getVar('Of');' alone causes a javascript error
What am I doing wrong? For testing I put GetURL() in the dnncore.js file and I am calling it from admin/security/signin.ascx