Skip to content

Support for conditionally showing sections of a form as it is filled #666

Closed
@JamesGuthrie

Description

@JamesGuthrie

I have a very long form which is made up of a number of fieldsets/sections. It would be nice to be able to reveal the fields to be filled section by section, i.e. once a section is filled and verified, the next section will automatically reveal itself.

It would be nice to have a way to determine if a section has been completed, something like a $isValid property on the section. I imagine it looking something like:

schema = {
  type: "object",
  properties: {
    one: {
      type: "string"
    }
    two: {
      type: "string"
    }
    three: {
      type: "string"
    }
    four: {
      type: "string"
    }
  }
  required: ["one", "two", "three", "four"]
};

form = [
  {
    key: "fieldset1",
    type: "fieldset",
    items: [...] // ("one" and "two")
  },
  {
    key: "fieldset2",
    type: "fieldset",
    items: [...], // ("three" and "four")
    condition: form.fieldset1.$isValid
  }
];

There are a couple things that I'm unsure of. For instance, is it possible to refer to fieldset1 by the key it was given in the form definition? The other is how validation is triggered in the section's scope, in order to populate the value of $isValid.

I would be happy to work on the feature and submit a PR, but I'm unsure as to where to get started on it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions