Skip to content

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.

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.

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 the file like any other. The .mdx extension is what turns it into a form.

Terminal window
s2u survey.mdx

You 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.

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.

Terminal window
s2u forms responses <formId> # list who submitted and when
s2u forms response <formId> <responseId> # decrypt and print one response

The 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.

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.