Files
marqdo/examples/web-net-site/forms.mq.md
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

37 lines
1.9 KiB
Markdown
Executable File

---
markup: occlusion
title: Article form resource
import:
form: ext/data/form.mq.md
---
The same form resource supplies the page controls and validates the system submission route. The serving entry mounts it as article. The page only places a reference, so fields, limits and errors cannot drift between two separate form implementations.
## article
| 返回 | 类型 | 说明 |
|---|---|---|
| result | any | Native insert form with title/body fields and original validation rules |
Call with plugin before listening. Title is required and limited to 120 characters; body remains optional with an 8000-character limit. These are the original site's server-side rules. Rendering neither inserts a row nor authenticates a user; submission uses the application's actual articles database and current CSRF context.
The field and rule tables stay immediately visible beside their explanation. No raw form HTML or client validation program is authored. After a valid submission the resource returns to the article list; rejected values retain field errors for correction. This public demonstration form is distinct from the login-gated native administration surface.
`fields` =
| name | label | type | required |
|---|---|---|---|
| title | Title | text | True |
| body | Body | textarea | False |
`rules` =
| field | rule | message |
|---|---|---|
| title | required | Title is required |
| title | max:120 | Title is too long |
| body | max:8000 | Body is too long |
We **selected = [Create the actual article insert resource](form.form(table="articles", action="insert"))** and **selected = [Attach the readable field definitions](> `selected`.fields fields=`fields`)** and **selected = [Attach the server validation rules](> `selected`.rules rules=`rules`)**.
Return *[Keep submission and cancellation copy with this resource](> `selected`.labels submit="Publish" cancel="Cancel" cancel_href="/")*.