---
title: "form"
slug: "cloud-sdk-events-browser-form"
abstract: "The form function sends a FORM event from the browser side."
---
# form

|     |     |
| --- | --- |
| Type | Function |
| Import path | `@sitecore-cloudsdk/events/browser` |

Sends a [`FORM`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-concepts/concepts-tracking/events/form-events.html "FORM events") event.

## Signature

```typescript
export async function form(
  formId: string,
  interactionType: "VIEWED" | "SUBMITTED",
  componentInstanceId: string,
): Promise<EPResponse | null>
```

## Parameters

| Name | Type | Description | Value |
| --- | --- | --- | --- |
| formId | string | Required.The UUID of the SitecoreAI form.To find the form ID in SitecoreAI Forms, click the form, then click Settings. The form ID is in the Form ID field. | "0c0910e5-5197-4dcf-8993-677e70bcb531" |
| interactionType | string | Required.The interaction the site visitor has with the form.Format: uppercase. | Must be one of:"VIEWED""SUBMITTED" |
| componentInstanceId | string | Required.The UUID of the component that contains the SitecoreAI form. Used for A/B/n testing. | "ac4109f5-9831-4abef-8005-647c70bfba01" |

## Return value

Returns a promise or null.

## Examples

:::tab{title="Next.js"}

Example 34. Running the form function

:::tab{title="Next.js"}
> [!note]
> To run this function, you have to first [initialize](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-events/cloud-sdk-events-browser/functions/cloud-sdk-core-browser-cloudsdk.html "CloudSDK") the Cloud SDK.
>
> See [more examples](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-events/cloud-sdk-events-browser/functions/form-events.html "FORM events").

Here's an example of how to use the `form` function:

```typescript
"use client"; // Used only in Next.js App Router
import { form } from "@sitecore-cloudsdk/events/browser";

export default function Component(){
  const sendFormEvent = async () => {
    await form(
      "0c0910e5-5197-4dcf-8993-677e70bcb531",
      "VIEWED",
      "ac4109f5-9831-4abef-8005-647c70bfba01"
    );

    console.log("Sent FORM event.");
  };

  return (
    <div>
      <button onClick={sendFormEvent}>send FORM event</button>
    </div>
  );
};
```

:::

:::