Table form
ResourceForm is a form over one table's rows that creates, edits or shows a row with the fields, routes and methods the table declares.
ResourceForm is a form over a data controller: pick the table and the mode, and its fields, routes and methods follow. It is the same form a TableView opens for that mode, placed on a page of its own. Use it for a dedicated "New task" page or a record's detail page; use Form to reach an endpoint of your own.
ResourceFormThe preview uses serialized resource fields and a fixed record served by the preview service. It renders the same form component as a resource-backed page, but has no write route: editing it does not save anything. In your application, the controller supplies the fields, permissions and persistence shown below.
Usage
import { PageController, RegisterPage } from "@antelopejs/interface-dms/page";
import { FormPageLayout } from "@antelopejs/interface-dms/base/layouts";
import { ResourceForm } from "@antelopejs/interface-dms/base/table-view";
import { taskDataAPI } from "../data-api/tasks";
const PAGE_PATH = "/tasks/form";
@RegisterPage()
export class TaskFormPage extends PageController(
"task-form",
{ displayName: "$app.tasks.form", icon: "i-ph-note-pencil", category: tasksCategory },
FormPageLayout(),
) {
static create = ResourceForm(taskDataAPI, {
mode: "new",
title: "$app.tasks.new",
redirectOnSuccess: `${PAGE_PATH}?id={{response._id}}`,
});
static edit = ResourceForm(taskDataAPI, { mode: "edit", title: "$app.tasks.edit", labelKey: "name" });
static view = ResourceForm(taskDataAPI, { mode: "view", title: "$app.tasks.details" });
}
Options
| Option | Type | Default | Description |
|---|---|---|---|
mode* Content | "new" | "edit" | "view" | – | Create a row, edit one, or show one read-only. |
title Content | string | – | |
description Content | string | – | |
submitLabel Content | string | – | |
successMessage Content | string | – | |
errorMessage Content | string | – | |
fieldsOrientation Layout | "horizontal" | "vertical" | – | |
redirectOnSuccess Behavior | string | – | The page to open once saved; {{response._id}} stands for the row just saved. |
mode | The form… |
|---|---|
new | Creates a row through the controller's new route. |
edit | Loads the row named by rowId, then saves it through edit. |
view | Loads the row named by rowId and shows it read-only. |
Three modes over the same controller
The three examples below show one of Helio's installation projects through each mode. They are the Form options a ResourceForm serializes to, over the same project fields. The new form starts from the fields' defaults (Residential solar, Planned):
FormThe edit form loads project CH-0104; its route accepts a save and keeps nothing:
FormThe view form shows the same record with every field read-only:
FormRecipes
Read the row from the route
edit and view read the row id from ?id= by default (QUERY_ROW_ID, {{query.id}}). A page served under a :id route segment passes rowId: ROUTE_PARAM_ROW_ID ({{params.id}}, from @antelopejs/interface-dms/base/table-view) instead. QUERY_ROW_ID comes from @antelopejs/interface-dms/base/resource-form-schema. A form opened by a row action in a drawer, a modal or a side panel passes rowId: "{{row._id}}": it reads the row the container shows, and the next one as the user steps (see Row drawers).
Open the row just created
redirectOnSuccess: "/tasks/form?id={{response._id}}" reopens the page on the row the new form wrote.
Add and remove a photo
The project forms above carry a Site photos image list. Adding a photo uploads the image first, then leaves the record's photo list as an unsaved change: uploading the bytes and saving the record are separate steps. After Save changes, the record holds the photo; removing it marks the list as changed again, and saving writes the empty list. That removes the photo from the record, not the stored file.
The examples on this site run without a backend, so an upload there fails: the upload needs the file routes of a running DMS.
See File storage for upload destinations and storage configuration. The upload URL must reach the storage provider's HTTP route, including when a local frontend proxy sits in front of the backend.
Pitfalls
- In
editandview, a page reached without its id shows "No entry selected" instead of empty fields (requiresRecord). - The form's routes require the action's permission from a table view of the controller that a page mounts: a table form adds no permission of its own. With no such table view, only a platform owner can submit it.



