Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

field matching? #305

Open
1 task done
Fanna1119 opened this issue Apr 20, 2022 · 0 comments
Open
1 task done

field matching? #305

Fanna1119 opened this issue Apr 20, 2022 · 0 comments

Comments

@Fanna1119
Copy link

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

when it comes to validation, sometimes you really need to match 2 fields.
consider the following for example.

const form = computed(() => ({
  id: "my-awesome-form",
  fields: {
    name: EmailField({
      label: "Email",
      validations: [
        Validator({ validator: required, text: "This field is required" }),
        Validator({
          validator: validateEmail,
          text: "Format of email is incorrect",
        }),
      ],
    }),
    password: PasswordField({
      label: "Password",
      validations: [
        Validator({ validator: required, text: "This field is required" }),
      ],
    }),
    confirmpassword: PasswordField({
      label: "Confirm Password",
      validations: [
        Validator({ validator: required, text: "This field is required" }),
        Validator({validator: (value: String) => value === form.password, text: "Passwords do not match"}),
      ],
    }),
  },
}));

const formSubmitted = (e: any) => {
  console.log(e);
};

confirmpassword needs to match password

Describe the solution you'd like

Ability to match 2 fields

Describe alternatives you've considered

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant