Skip to content

Run a custom validator

Run application-supplied validation logic that participates in the same error pipeline as property-level errors.

Field Value
Operation ID OP-BIND-007
Trigger Validate() / RefreshValidation() reaching a custom validator
Inputs The validation target object, optionally a key property, and a PropertyValidator or CustomValidator delegate
Outputs Messages appended to ControlErrors; the binder's error flag
Primary components clsObjectBindManager.AddCustomValidator (three overloads), clsCustomValidator.PerformValidation
Entry point SAIF.Presentation.Web.Binding.Infragistics111/clsCustomValidator.vb

Steps

  1. Reset the error flag.
  2. Branch on ValidationType:
  3. Property — invoke the PropertyValidationDelegate with the bind source, the bind property name, and the ControlErrors list so the application appends its own messages (BR-BIND-051).
  4. Method — invoke the MethodValidationDelegate with the validator itself; a False return sets the error flag (BR-BIND-052).
  5. Object — when the bind source is a SAIF framework object, resolve and return its IsValid property value (BR-BIND-053).

Origin: The Object branch delegates to the business object's IsValid implementation (clsBusinessBase, SAIF.Framework.Core); the callee's rule-evaluation steps are not visible from this repository.**

  1. A Nothing delegate is a silent no-op. (BR-BIND-054)

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Validate reaches custom validator]) --> S1[Reset error flag]
    S1 --> D{ValidationType}
    D -->|Property| S2[Invoke PropertyValidator delegate]
    D -->|Method| S3[Invoke MethodValidator delegate]
    D -->|Object| S4[Return bind source IsValid]
    S2 --> End([ControlErrors / error flag updated])
    S3 --> End
    S4 --> End

Failure and edge-case behavior

  • In the Property branch the delegate populates ControlErrors directly but PerformValidation never sets m_Errors = True, so ContainsError stays False and the manager does not surface those messages through Validate().*

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service.

Sources

  • SAIF.Presentation.Web.Binding.Infragistics111/clsCustomValidator.vb