blockly > FieldTextInput > doClassValidation_
FieldTextInput.doClassValidation_() method
Ensure that the input value casts to a valid string.
Signature:
protected doClassValidation_(newValue?: any): string | null;
Parameters
Parameter |
Type |
Description |
newValue |
any |
(Optional) The input value. |
Returns:
string | null
A valid string, or null if invalid.
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 `doClassValidation_` method in `FieldTextInput` is used to validate user input, ensuring it can be cast to a string."],["It accepts an optional `newValue` parameter representing the input and returns a valid string if the input is valid, otherwise null."],["This method is designated as `protected`, indicating it is intended for internal use within the class or its subclasses."]]],["The `doClassValidation_` method, part of the `FieldTextInput` class, validates input values to ensure they can be cast to a string. It accepts an optional `newValue` of any type as input. The method returns either a valid string if the input is acceptable or `null` if the input is invalid. This method ensures the input is a usable string.\n"]]