# TextFieldNode
Class Inherits FormControlNode
## About
`TextFieldNode` represents an HTML input field. It supports the editor's input-type enumeration, name and ID, default value, placeholder, autocomplete, validation attributes, and association with a `DatalistNode` already present in the document.
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| Types | Text <br > Search <br > Telephone <br > URL <br > Email <br > Password <br > Number <br > Range <br > Date <br > DateTimeLocal <br > Month <br > Week <br > Time <br > Color <br > File <br > Hidden | (None) |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| ActionItem | index As Integer | ToolbarItem | Returns the contextual toolbar item at the specified index. |
| AddVectorPDFAnnotations | pdf As PDFDocument <br> pageNumber As Integer <br> offsetX As Double <br> offsetY As Double <br> usedNames As Dictionary <br> formAction As String = "" | (None) | Adds this node's interactive annotations and form controls to a vector PDF page. Override for custom nodes. |
| CanImportHTML | element As HTMLSupport.HTMLElement | Boolean | Returns whether this node can import the supplied HTML element. |
| Constructor | value As String = "" | (None) | Creates a new text-field node. |
| Duplicate | (None) | Node | Returns an indepent copy of this node. |
| FromHTML | element As HTMLSupport.HTMLElement | Boolean | Imports a text input element. |
| FromJSON | data As JSONItem | Boolean | Restores state from JSON. |
| HTMLTags | (None) | String | Returns the HTML tag names supported by this node type. |
| InspectorSections | (None) | InspectorSection | Returns the text field properties exposed by the inspector, including any supported datalist association. |
| LastActionIndex | (None) | Integer | Returns the last zero-based action index supplied by this node, or -1 when there are no actions. |
| LocalizeToolbarItem | strings As GraffitiProEditor.Editor | (None) | Sets this node type's toolbar item text from the supplied editor's localization properties. The editor calls it when the type is registered, when the editor opens, and when a locale pack is applied to the editor. A custom node type can override it to localize its own toolbar item. |
| PerformAction | index As Integer <br> selectedItem As DesktopMenuItem | (None) | Handles the contextual toolbar action. |
| PerformToolbarAction | editor As Editor <br> selectedItem As DesktopMenuItem | (None) | Handles activation of the main-toolbar item. |
| PreferredHeight | g As Graphics <br> availableWidth As Double | Double | Returns the preferred height. |
| Render | g As Graphics <br> bounds As Rect <br> selected As Boolean | (None) | Draws the text field preview. |
| SupportsDatalist | (None) | Boolean | Returns whether the current HTML input type supports a datalist association. |
| ToHTML | (None) | String | Returns an HTML representation of this content. |
| ToJSON | (None) | JSONItem | Returns the persistent state as JSON. |
| TypeName | (None) | String | Returns the display name. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| AutoComplete | String | (None) | Gets or sets the autocomplete tokens. |
| DirName | String | (None) | Gets or sets the directionality submission field name. |
| InputMode | String | (None) | Gets or sets the input mode hint. |
| ListID | String | (None) | Gets or sets the associated datalist ID. |
| MaxLength | Integer | -1 | Gets or sets the maximum allowed text length; negative means unset. |
| MinLength | Integer | -1 | Gets or sets the minimum allowed text length; negative means unset. |
| Pattern | String | (None) | Gets or sets the validation pattern. |
| Placeholder | String | (None) | Gets or sets the placeholder text. |
| ReadOnly | Boolean | (None) | Gets or sets whether the value is read only. |
| Required | Boolean | (None) | Gets or sets whether a value is required. |
| Size | Integer | (None) | Gets or sets the visible character width. |
| SpellCheck | String | (None) | Gets or sets the spellchecking hint. |
| Type | Types | (None) | Gets or sets the HTML input type used by the field. |
| Value | String | (None) | Gets or sets the control value. |
## Notes
The active input type determines which field properties are applicable.
### Input Types and Datalists
Choose a semantic input type such as text, email, telephone, number, date, URL, password, or search through the inspector or popover menu. The Datalist selector is populated from datalist nodes in the same editor and always includes None.
Edit the default value using the same canvas-native editing interaction as other editable content. Type-specific properties are shown only where they apply.
### JSON Values
`inputType` stores `TextFieldNode.Types` as an integer:
- `0` Text, `1` Search, `2` Telephone, `3` URL.
- `4` Email, `5` Password, `6` Number, `7` Range.
- `8` Date, `9` DateTimeLocal, `10` Month, `11` Week, `12` Time.
- `13` Color, `14` File, `15` Hidden.
`maxLength`, `minLength`, and `size` are integers. `readOnly` and `required` are Boolean. `autoComplete`, `dirName`, `inputMode`, `listID`, `pattern`, `placeholder`, `spellCheck`, and `value` are strings. Common form-control and node fields come from the superclass serializers.
Each field is omitted at its default and restored to it when missing: `inputType` Text, `maxLength` and `minLength` `-1`, `size` `0`, `placeholder` "Text field", `readOnly` and `required` `False`, and empty strings for the rest.