Embed forms in page main via compose_form.

listen collects forms from home and routed pages so mount_form is optional; validation errors re-render the owning page shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-12 09:02:37 +08:00
1 parent 0dcd9e3d03
commit b09538d242
13 files changed
+272 -40

No files matched your search

+10 -2
View File
@@ -39,6 +39,14 @@ Assemble main from a bind table (`|属性|值|样式|` or `|front|back|css|`).
**> web_compose_main page=`self` main=`main`**
## compose_form
+ `form`
+ `id`
Embed a form into the page main slot. `listen` auto-registers `GET|POST /_form/{id}` from page/route forms (optional `app.mount_form`).
**> web_compose_form page=`self` form=`form` id=`id`**
## render
+ `db`=None
@@ -184,12 +192,12 @@ Mount an assembled page at `path` (e.g. `/about`). `/` is the home `page=`.
+ `id`
+ `form`
Register `GET|POST /_form/{id}` for listen.
Register `GET|POST /_form/{id}` for listen when the form is not already embedded via `page.compose_form`.
**> web_app_mount_form app=`self` id=`id` form=`form`**
## listen
Serve `/`, routed pages, `/_part/{id}`, `/_form/{id}`, and optional `/admin`.
Serve `/`, routed pages, `/_part/{id}`, `/_form/{id}` (from mounts + page embeds), and optional `/admin`.
**> web_listen app=`self`**