Forms

8TML > Reference

A form is an extension block of type form:

:::form post guestbook.php
## Sign the guestbook
? text     name   max=20            Your name
? password pw     max=16            Password
? area     msg    rows=3 max=200    Message
? check    news   value=yes checked Send me news
? radio    mach   value=c64 checked C64
? radio    mach   value=zx          ZX Spectrum
? select   group                    Group
+ v8     V8 Crew
- other  Other
? hidden   token  value=a81f
? submit   send   value=ok          Sign it
:::

Preview: Commodore 64, 40 columns

                                            
Sign the guestbook
Your name [____________________]
Password [________________]
Message
[______________________________________]
[______________________________________]
[______________________________________]
[x] Send me news
(*) C64
( ) ZX Spectrum
Group [V8 Crew v]
< Sign it >

The form block

  • :::form METHOD URL opens a form. METHOD is get or post; URL is where the form is sent, relative to the page.
  • A line that is exactly ::: closes it.
  • Inside, lines starting with ? are fields, and option lines follow a select. Every other line is normal 8TML: paragraphs, headings, lists and so on.
  • A page can have several forms. Forms don’t nest.
  • Outside a form, ? lines are ordinary text.

Field lines

? TYPE NAME OPTIONS LABEL
  • TYPE is one of the field types below.
  • NAME is the name sent to the server: ASCII letters, digits, - and ..
  • OPTIONS are key=value words from this list: max, rows, value, and checked (without a value). A value with spaces is written in double quotes: value="hello world".
  • LABEL is the rest of the line, and may contain inline markup.

A field line with an unknown type or without a name is ignored.

Type Field
text, password one line of text; password input is masked
area several lines of text
check a checkbox
radio one of a group
select a listbox with option lines
hidden a value the reader doesn’t see
submit, reset buttons

On the screen

  • The client lays out each field with its label: on one line if it fits, otherwise the label above the field.
  • Typical looks: [________] for text, [****____] for passwords, [x] for checkboxes, (*) for radio buttons, [V8 Crew v] for a listbox, < Sign it > for a button.
  • Fields are styled by the stylesheet keys field and, while selected, field-sel.
  • Fields and links share one focus order, in page order. Activating a field edits it in place (scrolling sideways when the value is longer than the box), toggles it, opens the listbox or presses the button.

Minimums

Every client supports at least 16 fields per form, 80 characters per text or password field and 255 per area. Clients may allow more.

How the data travels to the server is described under Sending.