Stay organized with collections
Save and categorize content based on your preferences.
blockly > Block > getField
Block.getField() method
Returns the named field from a block.
Signature:
getField(name: string): Field | null;
Parameters
Parameter |
Type |
Description |
name |
string |
The name of the field. |
Returns:
Field | null
Named field, or null if field does not exist.
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."],[[["\u003cp\u003eThe \u003ccode\u003egetField()\u003c/code\u003e method retrieves a specific field from a block using the field's name.\u003c/p\u003e\n"],["\u003cp\u003eIf a field with the provided name exists, the method returns a \u003ccode\u003eField\u003c/code\u003e object; otherwise, it returns \u003ccode\u003enull\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis method is part of the \u003ccode\u003eBlock\u003c/code\u003e class within Blockly and is used to access individual fields on a block for manipulation or inspection.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [Block](./blockly.block_class.md) \\\u003e [getField](./blockly.block_class.getfield_1_method.md)\n\nBlock.getField() method\n-----------------------\n\nReturns the named field from a block.\n\n**Signature:** \n\n getField(name: string): Field | null;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|--------|------------------------|\n| name | string | The name of the field. |\n\n**Returns:**\n\n[Field](./blockly.field_class.md) \\| null\n\nNamed field, or null if field does not exist."]]