hack4impact-calpoly/general-vms

[General] Scheme and Investigation for Representing Forms as Data

Closed this issue · 1 comments

This is a software design task. Admins/staff need to be able to create forms and users need to be able to fill them out.

This is based on https://www.notion.so/h4i/Form-creation-ab561f8da7f142dbb40594a8da1e8126

Forms will consist of:

  • Form fields
    • This includes a title question and the actual input
    • Field type: number, date, text, time, etc
    • Need whether it's optional/required
  • Form title and description
  • Date form is published
  • Whether form can be taken anonymously
  • options for what should happen after a form is submitted
  • predefined form type

This is probably best achieved partially by using a library like: https://github.com/rjsf-team/react-jsonschema-form. Something that takes a form/schema and dynamically renders the form so we don't have to do so.

At present, the react-jsonschema-form library appears to be a viable approach for storing and rendering forms for administrators and volunteers. Even though frontend developers will need to implement custom submission actions, some validation functions for fields like phone number and time (not date or date-time), and potentially form templates, using this library will be far more efficient than building this functionality from the gronud up.

I've experimented with the library in a sandbox environment and it appears that the flexible nature of JSON objects will allow us to add necessary fields such as creation date and whether the form can be completed anonymously. In fact, it might even prove advantageous to use this library when creating the form that admininstrators will use to generate internal forms.

The only points of uncertainty that remain are how to integrate the form with our current authentication protocol. I don't believe this will present any issues, but I'll update this once I have a better understanding of how we are maintaining user state.