--- title: "var (Read form variable)" slug: "calc-function-var" updated: 2026-05-12T13:37:36Z published: 2026-05-12T13:37:36Z canonical: "docs.lobstersoftware.com/calc-function-var" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # var (Read form variable) > [!NOTE] > The $var function makes it possible to read the content of a previously [Set variable](/v1/docs/en/freaction-set-var) in forms (e.g. in another element's behavior). > > **Hint**: Form flags are also variables. > > > [!TIP] > > Tooltip > > > > Syntax: *$var(varName)* > > > > | Parameter | Description | > > | --- | --- | > > | `varName` | The name of the variable. | > > > > Returns the value of the variable or *null* if it is not set or empty. ## Syntax *$var(varName)* ## Parameter | Name | Description | | --- | --- | | varName | The name of the variable. | ## Return value The value of the variable or *null* if it is not set or empty. ## Example In the following example, in a behavior with every "Change" **(1)** the content of the text field is written to a variable named "content" **(2)**. ![images/download/attachments/62864048/image2019-12-2_12-0-1-version-1-modificationdate-1610720662817-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2019-12-2_12-0-1-version-1-modificationdate-1610720662817-api-v2.png) When you click on the **Read variable...** button **(3)**, a [Calculate](/v1/docs/en/frebehav-calculate) behavior is executed **(4)**, which reads the variable "content" and passes it to a [Show alert](/v1/docs/en/freaction-show-alert) action (5), which displays this value. ![images/download/attachments/62864048/image2019-12-2_12-3-57-version-1-modificationdate-1610720662799-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2019-12-2_12-3-57-version-1-modificationdate-1610720662799-api-v2.png) **Result:** ![images/download/attachments/62864048/image2019-12-2_12-6-9-version-1-modificationdate-1610720662787-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2019-12-2_12-6-9-version-1-modificationdate-1610720662787-api-v2.png)