User Forms (writable_note Pages)

Pages can include user input forms using the writable_note block type. Form data is submitted to a server endpoint and saved to a directory.

Implementation

Backend (notes_web.py):

• New JSONHTL block type: writable_note• Renderer function _render_writable_note() generates HTML textarea + submit button• POST endpoint: /writeback/{notename} — receives form submission, saves to file• Save directory: /var/www/webdav/writeback/• Filename format: {notename}_{timestamp}.txt (ISO 8601 timestamp)

Frontend (JavaScript):

submitWritableNote() function handles form submission via fetch• Displays status feedback (Saving..., Saved ✓, or Error)• Clears textarea on successful save

Creating a Form Page

To create a new form page, add a writable_note block to your note's content:

{
  "title": "My Form Page",
  "content": [
    {
      "heading": {
        "level": 1,
        "text": "Submit Your Feedback"
      }
    },
    {
      "para": "Please enter your feedback below:"
    },
    {
      "writable_note": {
        "notename": "user_feedback",
        "placeholder": "Type your feedback here..."
      }
    }
  ]
}

writable_note Fields

notename (required): form identifier, saved in filename• placeholder (optional): textarea placeholder text

Validation

notename must match regex ^[a-zA-Z0-9_-]+$ (alphanumeric, underscore, hyphen only)• Invalid names return HTTP 400 with error message

Response Format

On success:

{
  "status": "ok",
  "saved": true,
  "notename": "user_feedback",
  "timestamp": "2026-05-08T18:15:32Z",
  "path": "writeback/user_feedback_2026-05-08T18:15:32Z.txt"
}

On error:

{
  "status": "error",
  "message": "description of error"
}