CodeForPhilly / CodeForPhilly/stately

Feature: Form designer

Open
#28 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
22
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Using this issue to jot down ideas about the form designer. We could try to reuse dobt's form designer ... but if we _didn't_....

We could use [dragula](https://bevacqua.github.io/dragula/) and HTML5's [contenteditable](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contenteditable), and simply serialize the DOM.

So there'd be a form area, and a way to add fields to it. Adding an `` would actually add a `

`. The `
` would have dragula enabled on it. Dragging it around simply rearranges it in the DOM. The `` and description `

` would have `contenteditable="true"`, letting the user directly edit their contents (which also just updates the DOM).

"Saving" the form would be a matter of exporting `formArea.innerHTML`. Sure, we could serialize it into JSON if we want to, but there may be an advantage to simply storing the HTML. For instance, you could very easily customize it to infinity. We'd just need a way to associate the fields with the data, but that shouldn't be too hard; just require that each field has a `` and use an underscorified_version_of_the_label as the field name.

Sounds like fun!

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named. Start by turning the proposed form area, dragula behavior, contenteditable labels and descriptions, and formArea.innerHTML export into a concrete scope; done should include an agreed design and defined persistence format.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.