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
277 stars 194 forks source link

Better support for read-only data #12798

Open short000 opened 3 years ago

short000 commented 3 years ago

User story

As a VFS developer, I need to the forms library to direct support read-only data, so that I can avoid inconsistent workarounds involving empty schemas and empty objects.

Additional details/notes/links

Read-only data is only pseudo supported, with a variety of ways that teams have gotten around this, (empty schemas, empty objects) but a consistent way to deal with this would be good. A good example is read-only demographic information. The current "View-only data" support is view only in the sense that it only appears client side, but still editable.

Ideally, we should be able to have a read-only data field. The data should be able to be loaded from a data source (API call), a calculation based on another field, or a static value (I do not that that is as useful).

Currently, teams have used a combo 'view:fieldName', a custom component that is tied to redux, empty schemas and/or hiding the header row on the review page.

It might look something like

    properties: {
              'claimInfo': {
                type: 'object',
                properties: {
                  claimId: {
                    type: 'string',
                    data:async (formData) => {
                      // load data for text field here
                    }
                  },
                },
              },
            },

Acceptance criteria

TBD

Point(s) of contact

@mdewey

What type of issue is this?

How to configure this issue

Mottie commented 3 years ago

Related to #12769

cvalarida commented 3 years ago

What would the form config look like for this read-only data? I agree that the current support is kind of hacky, but I don't have any ideas for alternatives.