Microsoft SDK for Java

Using the initForm Method

The initForm method is the major component in the programming model for all user interface programming in WFC. In the com.ms.wfc.html package, this method is in the DhDocument-derived class (for example, Class1 in Creating a DHTML Document) and is called from the constructor of the class.

Use the initForm method to initialize the Java components that represent the HTML elements you want to access and code to. As with the initForm method in Form-derived classes, there are certain restrictions when calling WFC methods from initForm in DhDocument. As a rule, you should call only methods in initForm that set properties. Moreover, you should bind only to elements on the HTML page using the setBoundElements method.

As a result of using the initForm method in this way, calling any method that resets or removes a property or element is strictly not supported in initForm. This also applies to any methods that attempt to locate elements on the existing HTML page (such as DhDocument.findElement).

The reason for this behavior is because the document on the existing HTML page is not merged with your DhDocument-derived class until the DhDocument.onDocumentLoad method is called. Use the onDocumentLoad method to retrieve properties and manipulate or locate elements in the existing HTML document. For information on using the initForm and onDocumentLoad methods on server-side classes, see Using the com.ms.wfc.html Package on a Server.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.