SetWeight

Description

Specifies the types of JavaScript code that will be included in the generated HTML or XHTML.

Applies to

DataWindow type

Method applies to

Web

Server component

Syntax

Web DataWindow server component

integer dwcomponent.SetWeight ( boolean allowupdate, boolean validation, boolean events, boolean clientscriptable, boolean clientformatting )

Argument

Description

dwcomponent

A reference to a Web DataWindow server component.

allowupdate

Specifies whether the generated HTML will be a form with INPUT elements so that the user can change the data. Values are:

  • True – The generated HTML is a form. The user can change the data.

  • False – The generated HTML is a table. The user cannot change the data.

When allowupdate is false, validation and clientformatting are ignored and no validation or formatting scripts are generated.

validation

Specifies whether the generated HTML will include scripts for validating data the user enters. The scripts implement validation rules defined in the DataWindow object. Values are:

  • True – The generated HTML has scripts that implement validation rules.

  • False – The generated HTML does not validate user-entered data .

Sets the value of the HTMLGen.ClientValidation property for the DataWindow object associated with the server component.

events

Specifies whether the generated HTML will include code for triggering events. Values are:

  • True – The generated HTML has scripts that trigger events.

  • False – The generated HTML does not trigger events.

Sets the value of the HTMLGen.ClientEvents property for the DataWindow object associated with the server component.

The available events are listed in the “DataWindow event cross-reference”.

clientscriptable

Specifies whether the generated HTML allows client-side scripts to call methods of the client control. Values are:

  • True – The generated HTML includes methods that the client scripts can call.

  • False – The generated HTML does not include methods.

This option adds approximately 100K to the generated HTML.

Sets the value of the HTMLGen.ClientScriptable property for the DataWindow object associated with the server component.

clientformatting

Specifies whether the generated HTML will include scripts for formatting data the user enters. The scripts implement display formats defined in the DataWindow object. Values are:

  • True – The generated HTML has scripts that format user-entered data.

  • False – The generated HTML does not format user-entered data.

Sets the value of the HTMLGen.ClientFormatting property for the DataWindow object associated with the server component.

Returns

Returns an empty string if successful and the syntax error message from the Modify method if it fails.

Usage

When code for more features is included, the Web DataWindow becomes a more robust tool for data entry and manipulation, allowing data validation, formatting, and client-side scripts that react to user actions. However, if your application does not use some of these features, you can decrease the size of the generated code by setting the appropriate options to false.

This method calls the Modify method of the server component’s DataStore to set the properties.

These properties can also be set in the DataWindow painter so that the settings are part of the DataWindow object definition.

For information about using the Web DataWindow, see the DataWindow Programmers Guide.

Examples

Example 1

This example specifies updating of data is not supported in the server component webDW, but events are supported so client-side scripts can respond to user actions:

webDW.SetWeight( false, false, true, true, false );

Example 2

This example specifies that all features are supported except client-side scripting. Scripts in the Web page will not be able to call Web DataWindow client methods:

webDW.SetWeight( true, true, true, false, true );

Example 3

This example specifies that all features are supported:

webDW.SetWeight( true, true, true, true, true );

See also