OnChange - cWebBaseDEO

Called when the contents of the control change

Type: Event

Parameters: String sNewValue String sOldValue

ParameterDescription
sNewValueValue after change
sOldValueValue prior to change


Syntax
Procedure OnChange String sNewValue String sOldValue

Description

In checkbox controls (cWebCheckbox, cWebColumnCheckbox), it is called when the checkbox is clicked. In all other controls, it is called if the contents of the control have changed and the focus leaves the control.

Set pbServerOnChange to True for the server side even to fire.

This fires only when the user changes the contents of the control, not if the value is changed programmatically (e.g. by a lookup list).

Sample

Procedure OnChange String sNewValue String sOldValue
    // do something
End_Procedure


Sample

This sample shows how to dynamically toggle the constraints of an "active" checkbox and an associated cWebList

Object oActiveCheckbox is a cWebCheckbox
    Set piColumnSpan to 4
    Set psCaption to "Show Only Active OEM Clients"
    Set pbServerOnChange to True

    Procedure OnChange String sNewValue String sOldValue
        Forward Send OnChange sNewValue sOldValue
        
        // sNewValue = "0" or "1"
        Constrain Customer.Active eq sNewValue
        // this forces the list to reload using the updated constraints
        Send MoveToFirstRow of oList
    End_Procedure
End_Object

Object oList is a cWebList
    // more code