Skip to content

Allow multiple fields to use the same key #7

@SachsKaylee

Description

@SachsKaylee

Is your feature request related to a problem? Please describe.
There are edge cases in which it can be important to bind two fields to the same data key.

Describe the solution you'd like
When creating a form, I'd like to be able to do e.g. this:

    <Form elements={[
      {
        key: "field",
        name: "This field has a validator that will pass after 1 second",
        type: DemoFieldString,
        validator: () => pass(1000, "Awesome")
      },
      {
        key: "field",
        name: "This field has a validator that will pass after 0-1.5 seconds",
        type: DemoFieldString,
        validator: () => pass(Math.random() * 1500, "Awesome")
      }
    ]} data={{}} onSubmit={action("onSubmit")} />

And let both fields have the same value.

Describe alternatives you've considered
The alternative would be to listen to the onChange event and modify the data passed into the form. Could work, but not pretty.

Additional context
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions