My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
Unexpected call to method or property access

onLoad() callbacks may throw this error because....


Attempting to read or write to ActivEdit instance properties in an onLoad or Page_OnLoad callback may throw "Unexpected call to method or property access". This is because the page has loaded, including the <object> tag for the instance, but the ActiveX control has not finished loading from Windows and so the object does not yet exist.

Here's a method used in ActivEdit to check for the object existence in the context of an onLoad callback.

function my_onLoad() {
// The instance I want to write to
 DHTMLSafe=aeObjects.myFieldName;
 if(DHTMLSafe.Busy) {
  setTimeout("my_onLoad();", 100); 
  return;
 }
    //OK to read and write to properties
}

Since ActivEdit already does this, you can use the API to do something after an ActivEdit instance loads. If the following function is found in your form page, ActivEdit will run it's contents for each instance after the instance loads. The function receives an object reference and the fieldname in its arguments.

function aeapi_local_onLoad(aeObject, fieldname) {
    // The object is loaded. Now do something.
    aeObject.DOM.body.innerHTML = someVar;
}

Search Knowledge Base:
Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement