In general, a field might have different validators. Based on various conditions, some of them can be turned on, and the remaining are turned off.
For instance, the following form asks user to fill in a number which must be a valid Brazilian ID (known as CPF) or VAT (known as CNPJ) number. CPF and CNPJ numbers have 11 and 14 characters respectively. Based on the length of input, we can guess which type of number user is trying to put in.
From that, we can turn on (off) the associated validator by using the enableFieldValidators() method.
In details, the example uses various options to archive the requirements:
Firstly, use the enabled option to enable (disable) validators initially
Lastly, turn on (off) the validators based on the length of field:
Below is the working example that you can play with: