SBM JavaScript Library Guide → Reference → Event Methods → AddChangeCallback
Used to respond to changes in fields and controls, with the restrictions noted under Comments, below.
| Name | Type | Description |
|---|---|---|
| fieldName | String | The name of the field to find. |
| callback | Function | The function to be invoked when the field or control changes. |
| Result | Value |
|---|---|
| (none) |
This example registers a named function to be called on change:
function customChangeCallback()
{
var itemType = GetFieldValue( "Item Type" );
if ( itemType == "Defect" )
{
EnableField( "Steps To Reproduce " );
DisableField( "Requested Changes" );
}
else
{
DisableField( "Steps To Reproduce" );
EnableField( "Requested Changes" );
}
}
AddChangeCallback("Item Type", customChangeCallback );
Callbacks are invoked in the order in which they are added. Note the following restrictions:
| Field/Control Type | Field Style | Notes |
|---|---|---|
| Binary/Trinary | Radio buttons | Use AddRadioCallback instead. |
| Single Selection, Single Relational, User | Allow searching | Not supported. |
| Multi-Selection, Multi-Relational, Multi-User, Multi-Group | Allow searching |
Before this method can be invoked to populate a searchable Multi-Group, Multi-Relational, Multi-Selection, or Multi-User field, values must be present in the left-hand box on the ListBox control. |
| Multi-Selection, Multi-Relational, Multi-User, Multi-Group | This method is not invoked for these field types when a user simply double-clicks a value or uses the right-hand arrow to move a value from the left-hand box on a ListBox control to the right-hand box. For the method to be invoked, the user must also click the values in the right-hand box to select them. | |
| Text field, EditBox control | This method is invoked only after the user changes the value and moves focus out of the field or control. |
Copyright © 2007–2019 Micro Focus or one of its affiliates. All rights reserved.