[GH-ISSUE #490] [Bug] - Error in Pricing Page Validation for Signup Now Modal #119

Closed
opened 2026-02-26 18:45:26 +03:00 by kerem · 7 comments
Owner

Originally created by @adithyaakrishna on GitHub (Oct 2, 2023).
Original GitHub issue: https://github.com/documenso/documenso/issues/490

Description:

On the pricing page here, https://documenso.com/pricing, when I click Signup Now, a modal pops up and then when I click Close (X) at the right side top corner, it validates the form instead of closing it immediately. The error validation persists even after closing the modal and seems to go off only when the page is refreshed

Please refer the video below for more reference :)

screen-capture (15).webm

Originally created by @adithyaakrishna on GitHub (Oct 2, 2023). Original GitHub issue: https://github.com/documenso/documenso/issues/490 **Description:** On the pricing page here, https://documenso.com/pricing, when I click **_Signup Now_**, a modal pops up and then when I click Close (X) at the right side top corner, it validates the form instead of closing it immediately. The error validation persists even after closing the modal and seems to go off only when the page is refreshed Please refer the video below for more reference :) [screen-capture (15).webm](https://github.com/documenso/documenso/assets/23498248/62ccdbf8-cf0d-49ed-844e-b0909697a6a4)
Author
Owner

@haaarsh619 commented on GitHub (Oct 2, 2023):

Can i work On this Issue ?

<!-- gh-comment-id:1742935058 --> @haaarsh619 commented on GitHub (Oct 2, 2023): Can i work On this Issue ?
Author
Owner

@adithyaakrishna commented on GitHub (Oct 2, 2023):

@haaarsh619 Sure, please go ahead :)

<!-- gh-comment-id:1742936257 --> @adithyaakrishna commented on GitHub (Oct 2, 2023): @haaarsh619 Sure, please go ahead :)
Author
Owner

@catalinpit commented on GitHub (Oct 2, 2023):

Hey @adithyaakrishna, thanks for highlighting this!

@haaarsh619 sure. Go ahead, please!

<!-- gh-comment-id:1742944462 --> @catalinpit commented on GitHub (Oct 2, 2023): Hey @adithyaakrishna, thanks for highlighting this! @haaarsh619 sure. Go ahead, please!
Author
Owner

@haaarsh619 commented on GitHub (Oct 2, 2023):

@catalinpit hey so i found two thigs to change i want to make sure i am doing right or not.

  1. so first i did that using useEffect when Dialog gets close form will get reset.
  2. when dialog opens it has autoFocus for name input show when inputs gets blur zod gives error due to mode: 'onBlur' so should i remove autoFocus from the input Or we can use onChange.
  const {
    register,
    handleSubmit,
    formState: { errors, isSubmitting },
    reset
  } = useForm<TClaimPlanDialogFormSchema>({
    mode: 'onBlur',
    defaultValues: {
      name: params?.get('name') ?? '',
      email: params?.get('email') ?? '',
    },
    resolver: zodResolver(ZClaimPlanDialogFormSchema),
  });
  useEffect(() => {
    if (!isSubmitting && !open) {
      reset();
    }
  }, [open]);
<!-- gh-comment-id:1743630633 --> @haaarsh619 commented on GitHub (Oct 2, 2023): @catalinpit hey so i found two thigs to change i want to make sure i am doing right or not. 1. so first i did that using useEffect when Dialog gets close form will get reset. 2. when dialog opens it has autoFocus for name input show when inputs gets blur zod gives error due to ``mode: 'onBlur' `` so should i remove autoFocus from the input Or we can use onChange. ``` const { register, handleSubmit, formState: { errors, isSubmitting }, reset } = useForm<TClaimPlanDialogFormSchema>({ mode: 'onBlur', defaultValues: { name: params?.get('name') ?? '', email: params?.get('email') ?? '', }, resolver: zodResolver(ZClaimPlanDialogFormSchema), }); ``` ``` useEffect(() => { if (!isSubmitting && !open) { reset(); } }, [open]); ```
Author
Owner

@dguyen commented on GitHub (Oct 3, 2023):

@haaarsh619 I think you should remove mode: 'onBlur' since we prefer validating on submit instead

<!-- gh-comment-id:1744015114 --> @dguyen commented on GitHub (Oct 3, 2023): @haaarsh619 I think you should remove `mode: 'onBlur'` since we prefer validating on submit instead
Author
Owner

@dguyen commented on GitHub (Oct 4, 2023):

/tip 20

<!-- gh-comment-id:1745967887 --> @dguyen commented on GitHub (Oct 4, 2023): /tip 20
Author
Owner

@algora-pbc[bot] commented on GitHub (Oct 4, 2023):

🎉🎈 @adithyaakrishna has been awarded $20! 🎈🎊

<!-- gh-comment-id:1745968051 --> @algora-pbc[bot] commented on GitHub (Oct 4, 2023): 🎉🎈 @adithyaakrishna has been awarded **$20**! 🎈🎊
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#119
No description provided.