department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
279 stars 195 forks source link

Parameterized Forms (JSON-driven, dynamic) #12796

Open short000 opened 3 years ago

short000 commented 3 years ago

User story

As a VSF developer, I want to pass in parameters to a form to dynamically customize questions, answers, text, or functionality, so that we can have one such parametrized dynamic form rather than maintaining a large set of similar forms.

Additional details/notes/links

WIP: I am not 100% percent sure on this one yet, but it comes down to the questions "When the form best able to be dynamically customized?" This can be questions, answers, text or functionality. I will work to nail down more specific requirements. Use Case: I want to create a form, that asks the same basic questions, but is customized base on parameters passed in, i.e. Healthcare data, appointment data, and user data. This information would affect not only questions, but also content and answers.

Value: Can customize forms based on ins, which can lead us to create a higher number of forms, faster. Impact of not done: I will have to a form for each VA facility. Original notes: Programmatically dynamic forms. Once a form gets loaded it’s difficult to change the form.js without doing a custom widget. Changing the for the user... Changing form configuration after the form is loaded. Use Case: I want to the form to say the User’s name or a Facility location in the question. I could probably use Redux to change it. I would love to have a Zoom over this feature and brainstorm and learn

Acceptance criteria

TBD

Point(s) of contact

@mdewey

What type of issue is this?

How to configure this issue

Mottie commented 3 years ago

It would also be useful to dynamically update the document title, page title and breadcrumbs to match the flow, e.g. for form 526EZ we need to show "File for disability compensation" when in the all-claims flow, and "File for Benefits Delivery at Discharge" when in the BDD flow.

cvalarida commented 3 years ago

Interesting... :thinking: Let's see if I understand this correctly. :smile:

The challenge here is that the forms library has limited capacity to update aspects of the forms (questions, field validation, breadcrumbs, title, etc.) based on information not included in the form configuration itself (user data).

Does this accurately reflect the difficulty y'all're encountering?

Mottie commented 3 years ago

I added some code to allow dynamic form titles - https://github.com/department-of-veterans-affairs/vets-website/pull/13998

and to make dynamic breadcrumbs by turning not including them in the registry.json and customizing them myself in https://github.com/department-of-veterans-affairs/vets-website/pull/14052

I added the previous comment since this work was a lot more hassle than it needed to be.

meganhkelley commented 2 years ago

@k80bowman passing this off to you to prioritize as you see fit