Proposal: Simple structured form specification

easrng easrng at gmail.com
Tue Jan 26 23:16:30 GMT 2021


I agree that Gemini should have forms, but that format doesn't look
great to me. What if forms were implemented as their own pages, not a
new link line type? I'm thinking something like this:

# Gemini Form Proposal
## Basic Format
Form fields are on their own line. Any line starting with `[in` is
considered a form element. This allows clients to continue to
determine line types by the first 3 characters. After the `[in`, a
dash is required.
After the dash, the input type is listed. If a client cannot handle an
input type, it SHOULD fall back to text. The rest of the line, up to
the first ] is used as options for the input. Next, there is a ]
character, then an optional text label.
## Escape sequences
In order to allow for ] characters, newlines, and literal backslashes
in input options, preface them with a backslash.
## Input types
Other types could be added, like number, email, phone, color, or even
file, but I feel this is an acceptable minimum set of types.
### text
A text input is a single line text input. Its format is as follows.
(Things in parentheses are optional)
```
[in-text <name>( <initial value>)]
```
For example,
```
[in-text userFullName Alex Fierro] What is your name?
```
### password
A password input is a single line text input that MUST hide the value
typed into it. For security reasons, there is now way to prefill a
password input. Its format is as follows.
```
[in-password <name>]
```
For example,
```
[in-password newPassword] What is your name?
```
### multiline
A multiline input is a text input that accepts any number of lines.
Its format is as follows. (Things in parentheses are optional)
```
[in-multiline <name> ( <initial value>)]
```
For example,
```
[in-multiline bio I am a demigod who enjoys art and the colors pink
and green.\nI usually use she/her pronouns, but sometimes I use
he/him.] Tell me about yourself
```
### submit
A submit input is a button that submits a form to a URL. It's label
SHOULD be used as the text on the button. Its format is as follows.
```
[in-submit /url/to/submit/to]
```
For example,
```
[in-submit /cgi-bin/profile.py] Update Profile
```
## Submitting
When an `[in-submit]` is (clicked|tapped|activated with the
keyboard|etc) all named inputs on the page (submit buttons are not
named) will be added to the URL of the submit button as query
parameters, and the resulting URL will be loaded.


- easrng


More information about the Gemini mailing list