Skip to content

Show related records beside a form

An aside puts one pane beside the content of a page. This guide uses it twice on the page of one member: first for the member’s payments beside the form, then for the list of every member beside the one being edited. It assumes a members table with a payments list(payments.member) column, and a payments table with a member ref(members) column, a paid_on date and an amount.

  1. Open the page that edits one member. It has a data row and a form.
  2. After the form, write aside with a label. The label is the heading of the pane and the name a screen reader gives it.
  3. Inside the aside, write a list of the member’s payments. :member.payments reads the relation of the page’s row, so the list shows this member’s payments only. Give it a limit:, because a pane is narrow and stays on screen while the page scrolls.
  4. Add a note when the reader needs a sentence beside the numbers.
page member "{:member.name}" {
route: /members/{id}
new_route: /members/new
access: board
data member of members
form of members { fields: name, status, fee_group }
aside "About this member" {
list of :member.payments "Payments" {
columns: paid_on, amount
sort: paid_on desc
limit: 5
}
note { text: "Fees are billed per season." }
}
}

The aside is the last item of the page, so the pane sits after the form: on the right in a left-to-right language. On a screen narrower than 48rem (768px) it sits below the form.

The list is the same region it would be outside the pane. Its access, its where: and its export do not change. On the create page (/members/new) the list is left out, because it reads the page’s row and there is no row yet. See new_route.

List every member beside the one being edited

Section titled “List every member beside the one being edited”
  1. Write the aside first, before the form. The pane then sits before the form: on the left in a left-to-right language.
  2. Inside it, write a list of members with a row -> link to this page. Each row opens the same page with that member.
page member "{:member.name}" {
route: /members/{id}
new_route: /members/new
access: board
data member of members
aside "Members" {
list of members "All members" {
columns: name
sort: name
row -> member
}
}
form of members { fields: name, status, fee_group }
}

The row of the member being edited is marked as the current one in the list, with aria-current="page" and a heavier weight. The engine marks a row in any list whose row -> link leads to the page’s own address, so no extra declaration is needed.

The page can have one aside, and it must be the first or the last item. An aside between two regions, a second aside, an aside without a label, and an aside with no region are refused. A report, a sheet and a matrix do not fit a pane; the message names the region. See aside for the full list.

Website privacy policy