Skip to content

Support hiding error messages on load/until field is touched #1882

Open
@julesterrien

Description

@julesterrien

Is your feature request related to a problem? Please describe.

Dup of https://spectrum.chat/jsonforms/general/hello-everyone-does-anyone-know-how-i-can-verify-that-the-form-is-valid-i-look-in-the-examples-and-i-do-not-see-an-example-of-validation-first-of-all-thanks~204272e3-08c1-495d-a711-f4a27116cc33

We have a use case where we don't want error messages (such as the default "is a required property" for required fields) on load, and only show error messages after the user has started touching the field.

Describe the solution you'd like

You could do
const isValid = typeof data === 'undefined' || errors.length === 0;
here
https://github.com/eclipsesource/jsonforms/blob/master/packages/vanilla/src/controls/InputControl.tsx#L67

Describe alternatives you've considered

You could keep track of dirty/pristine via some state and use that prop

Framework

React

RendererSet

Vanilla

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions