Event AfterFieldChanged Sample Project
17799
Question / Problem:
Event AfterFieldChanged Sample Project
Answer / Solution:
CASE
The attached project is configured with four fields, a Validation form, and a script that demonstrates two uses of the AfterFieldChanged event:
- For a given Text field, display the number of characters entered in the field
- For a given CheckBox field, display a string ("checked" or "unchecked") that represents the state of the CheckBox
COMPONENTS
This example uses the following fields:
- TextField — Input field into which you type the characters you want counted.
- TextFieldLength — Output field that displays the number of characters in TextField.
- Checkbox — CheckBox field.
- CheckboxState — Output field that displays the state of Checkbox, checked or unchecked.
VALIDATION FORM
The field "Checkbox" is formatted as a CheckBox on the Validation Form.
SCRIPT
The script example included in the project performs the usage described above:
Private Sub ValidationForm_AfterFieldChanged(ByVal pXDoc As CASCADELib.CscXDocument, ByVal pField As CASCADELib.CscXDocField) Dim iLength As Integer Select Case pField.Name Case "TextField" iLength = Len(pField.Text) pXDoc.Fields.ItemByName("TextFieldLength").Text = CStr(iLength) Case "Checkbox" If pField.Text = "1" Then pXDoc.Fields.ItemByName("CheckboxState").Text = "checked" Else pXDoc.Fields.ItemByName("CheckboxState").Text = "unchecked" End If End Select End Sub
Applies to:
Product | Version | Category |
---|---|---|
KTM | 6.3 | Scripting |
KTM | 6.2 | Scripting |