Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Survey form configuration #19

Open
twinkarma opened this issue Nov 17, 2024 · 0 comments
Open

Survey form configuration #19

twinkarma opened this issue Nov 17, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@twinkarma
Copy link
Contributor

I propose the use of a form configuration represented by JSON, similar to what was done with Teamware but doesn't have to be as complicated. Configurations are stored as a json field the Survey model.

When responding to a survey, this configuration is used to build the form and shapes the output structure of our responses. The responses of the surveys can also be stored as a json field an the Response model.

See the following board for more detail:
https://miro.com/app/board/uXjVLDlk-rQ=/

e.g. here's a basic configuration with 1 section and 2 questions in the section:

{
  "name": "Survey name",
  "description": "Description",
  "children": [ 
    {
      "type": "section", 
      "name":"Section name",
      "description": "Section description",
      "sectionType": "SORT",
      "children": [
        {
          "type": "text",
          "title": "Field title",
          "description": "Field description",
          "validation": "some regex",
          "defaultValue": "Default text",
          "isRequired": true
        },
        {
          "type": "likert",
          "title": "Please give a score",
          "options": [0, 1, 2, 3, 4],
          "isRequired": true
        }
      ]
    }    
  ]
}

Looks like django's Form class doesn't support dynamically adding fields. Probably best into either look into using the FormSet class or just roll our own form validator.

@twinkarma twinkarma added the enhancement New feature or request label Nov 17, 2024
@twinkarma twinkarma self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant