Skip to content

Commit

Permalink
7171 getting started with forms (#7192)
Browse files Browse the repository at this point in the history
* developer contributions to "Getting started with VA.gov Forms";
* add teams/vsa/engineering/forms-system as a place to include VSA work-in-progress guidance on forms
* video tutorial on forms
  • Loading branch information
short000 authored Mar 26, 2020
1 parent d5a35b4 commit 75ceb2f
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.m4v filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.sketch filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text
Expand Down
50 changes: 30 additions & 20 deletions teams/vsa/design/getting-started-with-va.gov-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ _With contributions from:_ VSA Design: Jonathan Nelson, Liz Lantz, Christian Val

So you’re moving a paper form online. Or moving a legacy online form to VA.gov. What are your next steps?

* [The Structure of a Form](#the-structure-of-a-form)
* [Content pages](#content-pages)
* [Introduction pages](#the-introduction-page)
* [Main form pages](#the-main-form-pages)
* [Sectioning](#sectioning-of-the-form)
* [List Loop Pattern](#the-list-loop-pattern)
* [Labeling](#labeling-of-fields)
* [Optional vs Required](#optional-vs-required-labeling)
* [Hint text](#hint-text)
* [Review page](#the-review-page)
* [Confirmation page](#the-confirmation-page)
* [Cross page topics](#cross-page-topics)
* [Legalese vs plain language](#legalese-vs-plain-language)
* [The Form Design Process](#the-form-design-process)
* [Product Managers](#product-managers)
* [Designers](#designers)
* [Developers](#developers)
* [FAQ](#faq)
- [Getting Started with VA.gov Forms](#getting-started-with-vagov-forms)
- [The Structure of a Form](#the-structure-of-a-form)
- [Content Pages](#content-pages)
- [The Application Status Widget](#the-application-status-widget)
- [The Introduction Page](#the-introduction-page)
- [The Main Form Pages](#the-main-form-pages)
- [Sectioning of the Form](#sectioning-of-the-form)
- [The “List Loop” pattern](#the-list-loop-pattern)
- [Labeling of Fields](#labeling-of-fields)
- [Optional vs Required labeling](#optional-vs-required-labeling)
- [Hint Text](#hint-text)
- [Other Components](#other-components)
- [The Review Page](#the-review-page)
- [The Confirmation Page](#the-confirmation-page)
- [Cross-Page Topics](#cross-page-topics)
- [Legalese Vs Plain Language](#legalese-vs-plain-language)
- [The Form Design Process](#the-form-design-process)
- [Product Managers](#product-managers)
- [Designers](#designers)
- [Developers](#developers)
- [FAQ](#faq)

## The Structure of a Form
![structure of a form](https://github.com/department-of-veterans-affairs/va.gov-team/blob/master/teams/vsa/design/flow.png "Structure of a Form")
Expand Down Expand Up @@ -164,8 +167,15 @@ This document will not attempt to rewrite those documents, however, we will prov
* Hierarchy/labelling

### Developers
* Make sure you read up on and understand form builder [https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms](https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms)/ and/or [watch the quick demo Chris V. gave to the design team](https://zoom.us/rec/share/x5FpP7XC1DJOYZ3d933GUagdMInqeaa82ilM-KcLzUxo_-q1CWuJcUJVwzaPXTp_) in Feb. 2020 (pw: vsadesign)
* Fill out a few forms on staging.va.gov to get a feel for the capabilities of the forms system
* Make sure you read up on and understand form builder:
* Fill out a few forms on staging.va.gov to get a feel for the capabilities of the forms system.
* [Watch the zoom video of a quick demo Chris Valarida gave to the design team](./va-forms-informal-for-designers.mp4) in Feb. 2020. He goes over an example JSON object used by react-jsonschema-form (RJSF), and toggles between it and the rendered UI, so developers may find it useful.
* Before coding, start with the VA<span/>.gov Forms System (VAFS) documentation on the [VA<span/>.gov Client Application Documentation site](https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/): **https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms**
* The forms documentation is not perfect. Read through VSA's informal notes at https://github.com/department-of-veterans-affairs/va.gov-team/tree/master/teams/vsa/engineering/forms-system. The documents there will be written from the perspective of developers consuming the library, so it may contain tips, gotcha's, and known issues.
* If you have determined that you need to implement custom behavior or appearance that the existing components do not support out-of-the-box, FIRST confirm with your design team that the feature is needed and cannot be implemented an alternate way that fits within the limitations of the existing forms framework. The va<span/>.gov Forms System (VAFS) is built on top of the VA's fork of react-jsonschema-form (RJSF), so if customization is required (or if you need a deeper understanding that goes beyond the tutorial), then you will need to dig one level deeper:
* Read the overview [Creating custom fields and widgets](https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms/creating-custom-fields-and-widgets), THEN
* Consult the lower-level RJSF documentation on the [GitHub Repository for the VA fork of RJSF](https://github.com/department-of-veterans-affairs/react-jsonschema-form). Although you may run into other web sites that cover RJSF, stick with the documentation used specifically by the VA fork.

* Make sure you start early when investigating data flows. Where will your data be coming from? Where will it be going?
* Note: enlist your PM to help you find answers to this
* Read up on and understand all APIs and associated data models. Think about and capture in your discovery tickets:
Expand Down
3 changes: 3 additions & 0 deletions teams/vsa/design/va-forms-informal-for-designers.mp4
Git LFS file not shown
20 changes: 20 additions & 0 deletions teams/vsa/engineering/forms-system/2020-03-forms-doc-feedback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## March 6, 2020 VSA Developer Feedback on Forms System
The documentation on VA<span/>.gov Forms System (VAFS) needs to be more accessible.
* Navigation: good information there, just really hard to find.
* Big gap in how to add to form builder. Ideally, every component in design.va.gov should be there, but we only get the bare minimum; primitives such as text fields.
* If we knew how to add a new component to form builder it would speed up our development processes and make the platform more cohesive across the board.
* The VAFS documentation does not contain a link to the VA fork of RJSF, even though the RJSF documentation is required to figure out most advanced things.
* This is the documentation we all have been using to learn VAFS: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms/.
* Here it mentions that VASF is based on RJSF: https://department-of-veterans-affairs.github.io/veteran-facing-services-tools/forms/creating-custom-fields-and-widgets/#how-vafs-uses-rjsf;
* However, you really need to go to the VA’s fork of RJSF at https://github.com/department-of-veterans-affairs/react-jsonschema-form to understand how to build/modify a form component. Many of our developers were not aware of this link (undocumented; it needs to be better disseminated).
* The original RJSF site (not the VA fork) had an interactive tool to demo or test your schemas (add data to see how things look): https://rjsf-team.github.io/react-jsonschema-form/; it would be awesome to have that in the VAFS documentation site.
* How to use the form builder (basics): the documentation is there (actually covered well) but hard to find, get around.
* The advanced parts, especially the internals of how it works, are not covered at all.
* Need lots of examples of different problems that people tried to solve, and how they solved them.
* Overall, there doesn’t seem to be a lot of documentation there beyond just setting things up. Once you get past the point of just setting things up, that’s where our documentation just falls off.
* Nothing there in terms of troubleshooting when things doesn’t work. The errors we get back from the forms system are generally worthless and while this means we also need better error handling we also need troubleshooting steps to use when things go wrong. Give a common set of scenarios and then what to look for in those scenarios.
* There may also be a disconnect between the actual steps you need to do to run the form generator vs the details you see under “getting started > common tasks”
* Need some opinionated standards around use of the form builder.
* We are all building the same things over and over again. Since this is the case we should have a set of opinionated “recipes” that serve as examples.
* Advice to “just look at the code and find examples” does not work because you’ll see different ways to accomplish the same thing. Which way is the right way?
* Documentation needs to be built for engineers so that it speaks to an engineering audience; our current documentation looks more like it is written for a design audience.
39 changes: 39 additions & 0 deletions teams/vsa/engineering/forms-system/possible-issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

This page is for capturing potential known issues with forms. Some of these may just be gotchas, quirks, suggestions for enhancements. Some might turn out to be defects. Once the details have matured they may be written up as GitHub issues and taken up by the platform team (VSP). \
<br/>
<br/>

## Review Page Does Not Show Empty Field and Crashes if Sorted (ui:order)
### Developer POC: Nick Sprinkle
### GitHub Issue#: TBD
### Problem
The review page does not show empty fields (appears to be by design, but undocumented). When we have empty fields, it also crashes when sorting (ui:order).

### Details
Using the forms system, there is an issue with the review page when using ui:order in combination with a ui:description object field when defining a field in the schema like this:
```json
{
type: 'object',
properties: {},
}
```
and when defining that same field in the UI schema with only a *ui:description* field, that field will be automatically dropped from the review page. This is intentionally behavior as the idea is to drop fields that are empty objects. The field is removed from both the schema and the UI schema. However, if using *ui:order*, the field is not dropped from this array. This causes the review page to crash when the field would be rendered. The error outputted is:
```
uiSchema order list contains extraneous property 'propertyName' .
```
### Commentary
There seems to be two issues: \
(1) The documentation does not explicltly mention that empty items will not be shown on the review page. We suspect that may be by design; however, that default behavior might not be desirable in all cases. \
(2) When sorting (ui:order) is also involved, the review page crashes. \
<br/>
<br/>

## Unable to Pre-Fill (pre-populate) Form
### Developer POC: Amen Ra
### GitHub Issue#: TBD
### Problem
(vague) - was unable to pre-fill (pre-populate) data into a new form

### Details
"Your Form ID has to match the in progess form endpoint in order to use the main form reducer. For instance form 2346 endpoint is /in_progress_forms/MDOT, the form id is MDOT" \
TODO: need more context, an example. This statement is probably a tip or (undocumented?) solution.
Empty file.

0 comments on commit 75ceb2f

Please sign in to comment.