# Forms

(forms)

## Overview

The `Forms` object serves as a scripting entry point to access all forms within a solution at runtime. It enables developers to retrieve form names, manipulate loaded forms, and interact with specific form instances. Accessible via `forms.<formName>`, it simplifies navigation and operations on forms while supporting code completion.

## Key Features

The `Forms` object provides access to all form names in the current solution, allowing iteration or direct access to forms using their names. Developers can determine the number of forms loaded into memory or interact with a form instance to manage its elements, controller, and variables. It is particularly helpful for dynamic form manipulation and integration with scripting workflows in Servoy applications.

## Properties Summarized

| Type                                                              | Name              | Summary                                     |
| ----------------------------------------------------------------- | ----------------- | ------------------------------------------- |
| [RuntimeForm](/reference/servoycore/dev-api/forms/runtimeform.md) | [\[name\]](#name) | Get a form by name.                         |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)          | [length](#length) | Get the number of forms loaded into memory. |

## Properties Detailed

### \[name]

Get a form by name.

**Type**\
[RuntimeForm](/reference/servoycore/dev-api/forms/runtimeform.md)

**Sample**

```js
var allForms = solutionModel.getForms();
application.output("There are " + allForms.length + " forms.");
for (var i=0; i<allForms.length; i++)
{
	var f = forms[allForms[i].name];
	application.output("Form " + allForms[i].name + " has selected index " + f.controller.getSelectedIndex());
}
```

### length

Get the number of forms loaded into memory.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
application.output("Number of forms loaded into memory: " + forms.length);
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/forms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
