WebSet

See Also: WebGet, Get, Set

Purpose

Sets a web property.

Syntax

WebSet PropertyName [of Object] to PropertyValue

Argument Explanation

PropertyName The name of the property whose value to set.

PropertyValue The value to set PropertyName to.

What It Does

For a web application to perform useful work, it is necessary to have persistent data that can be accessed from one server call to the next. This is accomplished using web properties. Since a property is sent to the server each time an server call is performed (i.e. each time an action or event is triggered on the server by the client), it means web properties can be considered persistent data from a given client instance. If a web property is changed on the server (using WebSet) then this changed value is passed back to the client.

Web properties are synchronized to a single client session while a server call is being processed from that client. At any other time, web properties should be considered out of scope, since there is no way of knowing to which client session (if any) they are synchronized.

A property is declared as a Web Property via the WebProperty meta data tag. Only properties of the cWebObject class (or a subclass) can be tagged as Web Properties:

{ WebProperty=True }

Property String psLabel ""

See WebProperty for more information.

You cannot WebGet or WebSet a property unless it is defined as a Web Property.

For more information about Web Properties see Web Properties, Methods and Events.

 

Example

To change the current value of the psValue property of a cWebForm after a user in a specific client session has changed that value, you must use WebSet.

Correct:

Procedure DoSomething

    String sValue

 

    WebSet psValue of oWebForm1 to "This changes the current value"

End_Procedure

If you were to use Set instead of WebSet, you would change the initial value of the property, rather than the current value of that property in the running client session.

Wrong:

Procedure DoSomething

    String sValue

 

    Set psValue of oWebForm1 to "This changes the initial value and will not be seen in a running client session"

End_Procedure

 

Note

WebSet psValue of oMyWebView to {value}