Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useStepsForm does not preserve form field values when returning to Previous step #269

Open
jayberry14 opened this issue Sep 28, 2023 · 0 comments

Comments

@jayberry14
Copy link

Hi guys, thanks in advance for the help

I've imported useStepsForm and used it as shown in the example code. Since the very beginning of using this hook I've not been able to preserve the field values when returning to a previous step in my form. The validation does work in this case.

If I then take the form prop returned from the useStepsForm hook and name it something besides 'form', the validation fails but the data from each field is properly preserved on previous steps after progressing further in the form. I suspect the validation fails because in this case the form isn't actually the same one as before, so it doesn't recognize the validation rules.

Any insights on this issue would be greatly appreciated! Let me know if you need any other information

const [rootForm] = Form.useForm();

const { form, current, gotoStep, submit } = useStepsForm({
    submit: async (values) => {
      onFinish(values);
      await new Promise((r) => setTimeout(r, 1000));
      return 'ok';
    },
    form: rootForm,
    total: fieldsKeys.length,
    isBackValidate: false,
  });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant