The Empty Validator Object

Empty validator is basically used with Validatable Text Box object to not allow empty input.

var btnSubmit = new TButton('Submit');
var layHorizontal = new THorizontalLayout();
var vtbSample = new TValidatableTextBox(300, new TEmptyValidator());
var wndCHVSample = createWindow('Empty Validator Sample');

var onValidate = function() {
      if (vtbSample.isValid()) {
         btnSubmit.enable();
      } else {
         btnSubmit.disable();
      }
};

btnSubmit.disable();
vtbSample.setValue('');
vtbSample.setOnValidationChanged(onValidate);

layHorizontal.add(new TText('Enter Text:'));
layHorizontal.add(vtbSample);

wndCHVSample.add(layHorizontal);
wndCHVSample.add(btnSubmit);
showModal(wndCHVSample);

When the user starts typing in the text box, the submit button is enabled.


Empty validator constructor takes one optional parameters:

new TEmptyValidator(callback);

Empty Validator Methods and Properties
Method/Property Description
getPhrase Gets validator object text message
setCallback Sets a callback that will be called after validation process. Form:

setCallback(callback)
validate Validates input text. Form:

validate(text)