# FormNode
Class Inherits TableNode
## About
`FormNode` is a container that exports an HTML form element and accepts other registered nodes as children. It can organize controls with tables, columns, labels, explanatory text, images, and application-defined nodes.
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| ActionItem | index As Integer | ToolbarItem | Returns the contextual toolbar item at the specified index. |
| AddNode | node As Node | (None) | Adds a child node to the form. |
| 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. |
| Constructor | (None) | (None) | Creates a new form container node. |
| Duplicate | (None) | Node | Returns an independent copy of this node. |
| ExportStyles | stylesheet As GraffitiProEditor.Stylesheet | (None) | Adds the stylesheet rules this node type's HTML output uses. |
| FromHTML | element As HTMLSupport.HTMLElement | Boolean | Imports a form 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 user-editable form properties exposed by the inspector. |
| 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. |
| Render | g As Graphics <br> bounds As Rect <br> selected As Boolean | (None) | Draws the form container and its children. |
| RestoreHTMLChildren | element As HTMLSupport.HTMLElement | (None) | Restores form children from HTML using the editor's registered node prototypes. |
| SupportsTextAlignment | (None) | Boolean | Returns False: a form draws its text with its block Alignment and has no TextAlignment of its own. |
| ToHTML | (None) | String | Returns an HTML representation of this content. |
| ToJSON | (None) | JSONItem | Returns the persistent state as JSON. |
| ToMarkdown | (None) | String | Returns the form as raw HTML because Markdown has no native form syntax. |
| TypeName | (None) | String | Returns the display name. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| AcceptCharset | String | (None) | Gets or sets the space-separated character encodings accepted by the server. |
| Action | String | (None) | Gets or sets the form submission URL. |
| AutoComplete | String | (None) | Gets or sets the form autocomplete mode. |
| Enctype | String | (None) | Gets or sets the form data encoding type. |
| ID | String | (None) | Gets or sets the form element ID used by external controls. |
| Method | String | (None) | Gets or sets the form submission method. |
| Name | String | (None) | Gets or sets the form name. |
| NoValidate | Boolean | (None) | Gets or sets whether interactive validation is disabled. |
| Rel | String | (None) | Gets or sets the link-type tokens for the form. |
| Target | String | (None) | Gets or sets the form submission browsing-context name. |
## Notes
The form is a document container as well as an HTML submission element.
### Form Attributes
The inspector exposes the HTML form attributes Action, Method, Encoding Type, Target, Autocomplete, Skip Validation, Name, ID, Relationship, and Accept Charset. Autocomplete maps to the form-level HTML `autocomplete` value and can be On or Off.
A form's children can be selected, edited, inserted, removed, and reordered independently. Drag insertion indicators show the exact child position rather than highlighting the complete form.
### JSON Format
`acceptCharset`, `action`, `autoComplete`, `enctype`, `id`, `method`, `name`, `rel`, and `target` are strings corresponding to the HTML form attributes. `noValidate` is Boolean. Values such as method, encoding type, target, and autocomplete remain their HTML-compatible strings rather than enum ordinals.
A form uses the inherited table-container representation for its children: `rows`, `columns`, and the row-major `cells` array of `TextSnapshot` objects. Embedded nodes are stored inside each cell snapshot's `nodes` array.
Each attribute is omitted at its default, an empty string or `False`, and restored to it when missing.
## Examples
Register a form prototype before inserting, importing, or restoring forms.
### Create a Form
```xojo
Var form As New GraffitiProEditor.FormNode
form.Action = "/contact"
form.Method = "post"
form.InsertChild(0, 0, New GraffitiProEditor.TextFieldNode)
form.InsertChild(0, 1, New GraffitiProEditor.ButtonNode("Send"))
Editor.AddNode(form)
```