blockly > Field > getValidator
Field.getValidator() method
Gets the validation function for editable fields, or null if not set.
Signature:
getValidator(): FieldValidator<T> | null;
Returns:
FieldValidator<T> | null
Validation function, or null.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `Field.getValidator()` method retrieves the validation function associated with editable fields."],["If no validation function is set for the field, this method returns null."],["The returned validation function, if present, adheres to the `FieldValidator` type and can be used to validate user input within the field."]]],["The `Field.getValidator()` method retrieves the validation function for editable fields. If a validation function is set, it returns a `FieldValidator\u003cT\u003e`. If no validation function is set, it returns `null`. The validation function is used to validate the input of the editable fields. The method itself does not perform any validation, only retrieves it.\n"]]