doc.gno
2.13 Kb · 50 lines
1// Package test is a Google-Forms-shaped questionnaire realm: publish a form,
2// collect responses on chain, read them back rendered — with gnoweb as the
3// only UI.
4//
5// # How it works
6//
7// The realm renders each form with p/jeronimoalbi/mdform. gnoweb turns that
8// markdown into a real HTML form whose submit builds a /vm.m_call to Submit,
9// mapping every input to the Submit parameter of the same name. A respondent
10// fills the form in a browser, signs with their wallet, and the answers land
11// in realm state. No frontend, no backend, no indexer.
12//
13// # Field encoding
14//
15// Create takes four parallel, pipe-separated strings so it stays usable from
16// gnokey and gnoweb without structured arguments:
17//
18// labels: "Name|Why gno.land?|Server type"
19// kinds: "text|textarea|select"
20// required: "1|1|0"
21// options: "||cloud,on-prem,data-center"
22//
23// Kinds are text, textarea, number and select. Options are comma-separated
24// and only read for select fields. A form has at most MaxFields (8) fields;
25// Submit accordingly takes eight answer slots, of which the form's field
26// count are read and the rest must be empty. gnoweb passes "" for any
27// parameter the form does not render an input for.
28//
29// # Who pays
30//
31// Respondents pay the storage deposit for their own answers, which is the
32// spam resistance. Withdraw deletes a response and the chain refunds the
33// deposit to the caller — which is why only the author may withdraw: a
34// deletion by the owner would refund the owner with the respondent's coins.
35//
36// # What is public
37//
38// Everything. Answers, who gave them, and when are all readable by anyone
39// from realm state and from the transactions themselves. This realm is for
40// information that can be public. Sealed responses would need encryption
41// on the respondent's side before the transaction exists, which gnoweb
42// cannot do on a realm's behalf; that is a deliberate non-goal of v1.
43//
44// # Routes
45//
46// /r/<ns>/forms index
47// /r/<ns>/forms:<id> a form, fillable
48// /r/<ns>/forms:<id>/responses responses, paginated
49// /r/<ns>/forms:<id>/responses.csv responses as CSV in a code block
50package test