Stay organized with collections
Save and categorize content based on your preferences.
blockly > FieldNumber > doClassValidation_
FieldNumber.doClassValidation_() method
Ensure that the input value is a valid number (must fulfill the constraints placed on the field).
Signature:
protected doClassValidation_(newValue?: any): number | null;
Parameters
Parameter |
Type |
Description |
newValue |
any |
(Optional) The input value. |
Returns:
number | null
A valid number, 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["`FieldNumber.doClassValidation_()` is a protected method used to validate the input value for a number field in Blockly."],["It ensures the input adheres to any constraints placed on the field, such as minimum or maximum values."],["If the input is valid, the method returns the validated number; otherwise, it returns null."]]],["The `doClassValidation_` method, part of the `FieldNumber` class, validates an input value to ensure it's a valid number. It accepts an optional `newValue` of any type as input. The method's core action is to check if the input fulfills the field's constraints. It returns a valid number if the input is valid; otherwise, it returns `null`, indicating the input is invalid.\n"]]