Developer

Input Validation

NextEditor6 (NxEdit6, NxSpinEdit6, NxDatePicker6 etc.) components can be easily validated with several built-in methods, properties and events.

First, validation process need to be invoked (started) in one of the following ways:

- Calling Validate public method from code.
- Specifying ValidationTriggers property and waiting user to meet criteria from this property (e.g. leave control, start typing).

In both solutions, ValidationResult property is set, and control now can indicate is whether valid or invalid.

Validation itself is done inside OnValidate event:

procedure TForm3.NxEdit61Validate(Sender: TObject; const Value: WideString; var Result: TNxValidationResult); begin if Value = '' then Result := vrInvalid; end;

See also