# Working with Page-Level Action Scripts

This tab is for managing <mark style="color:red;">local actions</mark> within the current page. You can:

* Create new scripts by clicking "+ New Script" in the first panel.
* The second panel shows your current script, where you can:
  * Add actions
  * Rearrange actions via drag-and-drop
* Edit action details in the third panel.
* **JavaScript Editor**: If you have a `"function"` action, click the gutter / line number next to the `function` key to open the JavaScript editor.
* **Disabled**: Temporarily disable a script without deleting it.
* **Run**: Execute the script immediately for testing purposes.
* **Delete**: Permanently remove the script.

By organizing your logic into named scripts, you can create more modular, reusable, and maintainable actions within your BetterForms pages.

For example, when a `function` action is selected in the script editor, clicking the line number next to the `function` key opens the JavaScript editor modal:

<figure><img src="/files/mfFF2mSLk6tfB9S91WLP" alt="Click the line number next to the function key to open the JavaScript editor"><figcaption></figcaption></figure>

{% hint style="info" %}
**Priority of Local Scripts**: Local scripts take priority over global scripts. For example, if both local and global scripts define a namedAction `"someAction"`, the local script will be executed on this page.
{% endhint %}


---

# 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.klai.studio/getting-started/ide-quick-tour/environment/pages-deep-dive/page-action-scripts.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.
