SelfscribeDownloadOpen the app

Sign-up and feedback

Forms that write each answer into a table, with counts and charts that keep up.

Interactive · Advanced · uses form, chart, totals, print

Edit it in the playgroundRead the file

What it shows

Collect answers with a form that writes into a table.

What you learn

Values set once and filled in anywhere, a form laid out in groups, a data block hidden behind the form, counts and charts of the answers, a paper form for the door.

Try this

  • Sign up with the form, choosing a bike, and the bike slice and the head count grow.
  • Change the set day line in the rules block, and the date on the page follows.
  • Change Hana Kim's no to yes in the signups block, and the head count goes up by one.
examples/survey-form.self · 147 lines
~~~ selfscribe
# Lesson: Collect answers with a form that writes into a table.
# You learn: values set once and filled in anywhere, a form laid out in groups, a data block hidden behind the form, counts and charts of the answers, a paper form for the door.
# Try this: sign up with the form, choosing a bike, and the bike slice and the head count grow.
# Try this: change the `set day` line in the rules block, and the date on the page follows.
# Try this: change Hana Kim's `no` to `yes` in the signups block, and the head count goes up by one.
# summary: Forms that write each answer into a table, with counts and charts that keep up.
# category: forms
# tags: interactive, advanced, social
# uses: form, chart, totals, print
use data
use form
set title Sign-up and feedback
set style sans wide compact

# ---- "set NAME value": a value kept once, shown wherever {{NAME}} is written ------------
set day Saturday 14 November, 10:00 to 13:00
set hall St Anne's church hall, Mill Road
set host Grace Adebayo

# ---- Colours, each with its shade for dark pages -------------------------------------
palette
  accent  #2f7d4f  dark #7fd1a0
  soft    color-mix(in srgb, var(--accent) 9%, transparent)
  line    color-mix(in srgb, currentColor 13%, transparent)

# ---- "{{day}}" anywhere in the text: the value of "set day" -------------------------------
# use form fills {{…}} only inside a form, so this rule fills them everywhere else.
inline {{_}}                 -> var           { font-style: normal; font-weight: 650 }  as rc-var

# ---- The top of the page: "kicker left | right", a lead paragraph, the facts --------------
line   kicker _              -> div.kicker    split "|" span  { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3em 1em; padding-bottom: 0.8em; border-bottom: 1px solid var(--line); font: 700 0.72em/1.3 var(--doc-font-ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent) }  as rc-kicker
line   lead _                -> p.lead        { max-width: 34em; margin: -0.3em 0 1em; font-size: 1.15em; line-height: 1.5 }  as rc-lead
# "WHEN …" and "WHERE …": the facts of the day, as chips with a dot.
line   WHEN _                -> span.fact     group div.facts  as rc-when
line   WHERE _               -> span.fact     group div.facts  as rc-where
class  facts  { display: flex; flex-wrap: wrap; gap: 0.5em; margin: 0 0 1.6em }
class  fact  { padding: 0.35em 0.9em; border-radius: 999px; background: var(--soft); font: 600 0.9em/1.4 var(--doc-font-ui) }
class  fact::before  { content: "●"; color: var(--accent); margin-right: 0.5em }

# ---- ":::: pair" with two "::: panel" blocks: the form beside its tally --------------------
block  :::: pair ... ::::    -> div.pair      { display: grid; grid-template-columns: repeat(auto-fit, minmax(19em, 1fr)); gap: 1.2em; align-items: start; margin: 0 0 2em }  as rc-pair
block  ::: panel ... :::     -> section.panel { padding: 1em 1.2em 0.4em; border: 1px solid var(--line); border-radius: 16px }  as rc-panel
# "### …" heads a panel.
line   ### _                 -> div.panel-title  { margin-bottom: 0.2em; font: 700 1em/1.3 var(--doc-font-ui) }  as rc-panel-title
class  panel > p  { margin: 0 0 0.6em; font-size: 0.9em; opacity: 0.75 }

# ---- "::: card" … ":::": a dashed card to print, around the paper form -----------------
block  ::: card ... :::      -> section.card  { max-width: 30em; margin: 1em 0; padding: 1em 1.4em; border: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 14px; background: var(--soft) }  as rc-card
~~~
kicker Mill Road repair café | Second Saturday of the month
# Repair café

lead Bring something broken and fix it with a volunteer beside you. Tea, cake and the fixing are free.

WHEN {{day}}
WHERE {{hall}}

:::: pair
view: signups as form plain title "Save a place at a table" layout You: name | email, "Your repair": coming, bringing, fault, "Can you help?": helping, skills

::: panel
### Coming so far
One form for each thing to fix, so the right fixers are at the tables.

view: signups as stats filter coming != no columns helping sum people plain

view: signups as chart donut by bringing filter coming != no plain
:::
::::

```data signups as hidden
name:text required placeholder 'Your name', email:text help 'Only for a reminder the day before', coming:choice(yes|maybe|no) default yes, bringing:choice(small appliance|clothes|bike|electronics|furniture|nothing to fix) required, fault:text placeholder 'The toaster stops after a minute', helping:toggle help 'Tick it if you can fix things too', skills:suggest(sewing|soldering|bike repair|woodwork|electrics), people = 1
Amira Haddad, amira.h@example.com, yes, small appliance, Kettle will not switch off by itself, no,
Ben Carter, ben.carter@example.com, yes, bike, Gears slip on the two biggest sprockets, yes, bike repair
Chloe Martin, , maybe, clothes, Zip on a winter coat has come apart, no,
Dev Patel, dev@example.com, yes, electronics, Radio crackles when the dial moves, yes, soldering
Elsie Moore, elsie.moore@example.com, yes, furniture, Kitchen chair wobbles, no,
Frank Osei, , yes, small appliance, Food mixer runs but the bowl does not turn, no,
Hana Kim, hana.kim@example.com, no, clothes, Hem on two pairs of trousers, no,
Isaac Lewis, isaac.l@example.com, yes, nothing to fix, , yes, "sewing, woodwork"
Lucía Romero, lucia.r@example.com, yes, electronics, Laptop charger cable is frayed at the plug, no,
Tomasz Wójcik, , yes, bike, Back brake rubs on the wheel, no,
```

## Who is bringing what

{{host}} sets the tables out by this list on the Friday night.

view: signups as table columns name, coming, bringing, fault sort bringing filter coming != no plain

## Came in October? Tell us how it went

:::: pair
view: feedback as form plain title "Tell us about your visit" layout "Your visit": visit | fixed, "How was it?": score, again, comment

::: panel
### What October's visitors said

view: feedback as stats sum answers, "would come again" avg score plain

view: feedback as chart donut by fixed plain
:::
::::

```data feedback as hidden
visit:date default today, fixed:choice(fixed|partly|not fixed|just visited) required, score:rating help 'Five stars: we would tell a friend', again:toggle help 'Would you come again?', comment:text placeholder 'What should we change?', answers = 1, would come again = if(again; 1; 0)
2026-10-10, fixed, 5, yes, Grace and Tom found the blown fuse in five minutes.
2026-10-10, fixed, 4, yes, A long wait for the sewing table.
2026-10-10, partly, 4, yes, The lamp works but needs a new switch. We know which one to buy.
2026-10-10, not fixed, 3, yes, No spare part for the coffee machine.
2026-10-10, fixed, 5, yes, My son learnt to patch his own bike tube.
2026-10-10, just visited, 4, no, Lovely cake. Too far for me to come often.
2026-10-10, fixed, 5, yes, "More soldering irons, please."
```

view: feedback as table columns fixed, score, comment sort score desc plain

## No laptop at the door?

Print this card for people who walk in on the day, and type their answers into the form above afterwards.

::: card
@scope form
? Name
? What are you bringing, and what is wrong with it?
( ) Coming to fix something
( ) Coming to help
[ ] Text me about the next one
@end
:::

## How it's made

- Each form is a view of a data block: `view: signups as form plain layout You: name | email, …`. Press Add, and the form writes a new line into the block.
- The blocks are marked `as hidden`, so the page shows the forms and the totals, not the raw rows. Switch to Source to read them.
- The tally beside the form reads the same rows: `as stats` for the tiles and `as chart donut by bringing` for the ring. `people = 1` counts each sign-up once, and `filter coming != no` leaves out the people who said no.
- The date, the hall and the host are `set` lines in the rules block, and `{{day}}` shows the value anywhere in the text. The card at the end is `use form`: `? Name` is a line to write on, `( )` a choice and `[ ]` a box to tick.

## Try it yourself

1. Sign up with the form, bringing a bike. The bike slice and the head count grow, and your line appears in "Who is bringing what".
2. In the `signups` block, change Hana Kim's `no` to `yes`. The head count goes up by one and the clothes slice grows.
3. In the `signups` block's first line, put `phone:text,` before `people = 1`. Then add `| phone` after `email` in the form's layout. The form gets a phone field beside the email.
4. Change `as chart donut` under October's answers to `as chart bar`. The ring becomes bars.

Next: *Printable checklist* is a form to fill in with a pen. *Contacts* adds a line with a form, too.