Question T14245
Visible to All Users

Custom question doesn't have all validator types.

created a year ago

Hello, we have a problem that when a custom question is created (on Angular), there is only one validator option, while on built-in text question there are muiltiple options. Is it possible to have these built-in options on a custom question?

Answers approved by surveyjs Support

created a year ago

Hello,
To display more validator options for a custom question type, obtain the settings.supportedValidators item for your custom question type and assign a JavaScript array of validator options to it:

JavaScript
import { settings } from "survey-core"; settings.supportedValidators["custom-question-type"] = [ "numeric", "regex", "text", "email" ];

For the record: you can review built-in validators in our source code: validator.ts.

Please let me know if you have any questions.