Interactive forms
A share is usually a file someone opens. A form is a file someone fills in. Share
an .mdx file written with a few form tags and Share2Us renders it as a fillable
form: multiple choice, checkboxes, and text boxes that a signed-in visitor submits.
Answers come back to you alone, sealed end to end.
Author a form
Section titled “Author a form”A form is an ordinary text file with an .mdx extension. It may contain only three
tags, plus Markdown for the question text:
<Form title="Quick survey">
Thanks for helping out. It takes a minute.
<Question id="plan" type="choice" required="true">Which plan fits you best?<Choice>Free</Choice><Choice>Pro</Choice><Choice>Max</Choice></Question>
<Question id="likes" type="multi">What do you use? Pick all that apply.<Choice>Command line</Choice><Choice>Desktop app</Choice><Choice>Browser</Choice></Question>
<Question id="missing" type="long">What is the one feature you wish we had?</Question>
<Question id="email" type="email">Leave your email if you want a reply. Optional.</Question>
</Form>Only <Form>, <Question>, and <Choice> are allowed. Any other tag is rejected,
and the file is never executed as code, so a form can never run script on the
people who open it.
Question types
Section titled “Question types”| Type | What the visitor sees |
|---|---|
short |
A single-line text box |
long |
A multi-line text box |
choice |
Radio buttons, one answer (needs two or more <Choice>) |
multi |
Checkboxes, any number of answers (needs two or more <Choice>) |
email |
A text box validated as an email address |
number |
A numeric box |
date |
A date picker |
Every <Question> needs a unique id. Add required="true" to make an answer
mandatory. The <Form title="..."> sets the heading.
Share it
Section titled “Share it”Share the file like any other. The .mdx extension is what turns it into a form.
s2u survey.mdxYou get back a normal link. Anyone who opens it, once signed in, sees the form and can submit it. If the file is not a valid form, the upload is rejected and tells you exactly what to fix.
Read the responses
Section titled “Read the responses”Responses are encrypted in the browser before they are sent and sealed to your devices, so the server stores only ciphertext. You read them where your keys are: the CLI, or the portal.
s2u forms responses <formId> # list who submitted and whens2u forms response <formId> <responseId> # decrypt and print one responseThe formId is the share’s id from the link. Listing shows the submissions as
metadata (who, when, whether you have read it); fetching one decrypts the answers
locally and prints them.
What the server can and cannot see
Section titled “What the server can and cannot see”The form itself, the question set, is stored in the clear so it can be rendered. The answers are not: each response is encrypted on the respondent’s machine and sealed to your device keys, exactly like an end-to-end encrypted file (see Encryption). No API endpoint can return the plaintext of a response, because nothing on the server side holds the key. The server keeps only masked metadata: that a submission happened, and when.