Define a form / order block
set_formAttach a form viewers can fill in (sign-ups, orders, bookings, leads) to a page: you only define the fields; the platform renders the form in the reading page (mobile-friendly, validated), and each submission lands as a row in this data table, readable with list_data_rows. No form code needed (a plain posting to ./_data/ works too). Idempotent: creates the table when absent, otherwise replaces the whole field definition (rows already collected are kept). fields: at most 20 items of { key, label, type, required?, options?, min?, max? }; six types: text (single line), textarea, select (options), multiselect (options, stored joined with 、), number (min / max), phone (11-digit mobile). amount is optional and only displays a price: { unit_price_cents, qty_field? (which number field holds the quantity) }; the platform computes the total as unit price × quantity and writes it into each row as _amount_cents — no money is collected (payment guidance and real payment are separate tools). Each row also carries _form_rev (the table version at submission time). Viewer write-back is open by default (append_open=true); pass false to close it. Submissions remain rate-limited and text is moderated first: approved rows appear for viewers on refresh, flagged rows are visible only to you in list_data_rows. Preview and presenter sessions never submit; the author and other workspace members can submit on the live page while signed in, and their rows record which member (by) without counting as a visitor. With members_only=true only members can submit and visitors do not see the form. Share the page after defining the form; the page does not need republishing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | 表名,例如 signup、orders;提交的行落在这张表 | |
| title | No | 表单标题,也是查看页里那枚按钮的字,例如「报名」「下单」;缺省「填写」 | |
| amount | No | 显示金额;不传 = 不显示金额 | |
| fields | Yes | 字段定义,按顺序渲染 | |
| revision | No | 可选:get_data 返回的当前 revision,传了就防并发(不一致 409);不传按当前修订写 | |
| append_open | No | 读者写回开关,缺省 true;false = 表单不显示、提交被拒 | |
| proposal_id | Yes | ||
| members_only | No | Accept submissions from workspace members only (visitors do not see the form and get 403); omitted = keep the current value, false for a new table |