Events for the documenttype object, Onfield events – Kofax DOKuStar Validation User Manual
Page 47
DOKuStar Validation Programming Manual
Page
• 43
Events for the DocumentType Object
OnField Events
For the
DocumentType
object, the same
OnField
... events are available as for the
FieldType
object. These
events will be fired for any field on the document.
Definition (example
OnFieldChanged
):
Private Sub doc_OnFieldChanged(ByVal Field As Field, ByVal SubField As Field)
This is a convenient way of handling all fields of a certain document type together.
Example: Suppose a document type
TaxForm
exists with several of amount fields. The only other field is a field
named
IdentityNumber
. Whenever the user corrects one of the amount fields, it shall be checked if a correct
format has been entered.
This could be solved as follows:
Option Explicit
Dim WithEvents taxForm As DocumentType
Private Sub Application_OnProjectLoaded(ByVal App As Application)
Set taxForm = App.Project.DataSet.Schema.DocumentTypes("TaxForm")
End Sub
Private Function taxForm_OnFieldChanging(ByVal Field As Field, ByVal SubField As Field, _
ByVal VerifyEventArgs As VerifyEventArgs) As Boolean
taxForm_OnFieldChanging = True
If Field.Name <> "IdentityNumber" Then
If Not ValidFormat(Field.Value) Then
MsgBox ("You entered an invalid amount")
taxForm_OnFieldChanging = False
End If
End If
End Function
Private Function ValidFormat(fieldValue As String) As Boolean
'* code to check the format
End Function
This produces an
OnFieldChanging
event for every field on the
TaxForm
. We exclude the
IdentityNumber
field and do the checking for all other fields.