diff --git a/Client/src/app/documents/components/CreateLink.tsx b/Client/src/app/documents/components/CreateLink.tsx index c58ec7e..a7660d5 100644 --- a/Client/src/app/documents/components/CreateLink.tsx +++ b/Client/src/app/documents/components/CreateLink.tsx @@ -53,7 +53,7 @@ export default function CreateLink({ onClose, open, documentId }: CreateLinkProp requiredUserDetailsOption: 1, }; - const { values, setValues, validateAll, getError } = useValidatedFormData({ + const { values, setValues, validateAll, getError, handleBlur } = useValidatedFormData({ initialValues: initialFormValues, validationRules }); @@ -144,6 +144,7 @@ export default function CreateLink({ onClose, open, documentId }: CreateLinkProp const { loading, handleSubmit, error, toast } = useFormSubmission({ onSubmit: async () => { const hasError = validateAll(); + if (hasError) { throw new Error('Please correct any errors before generating a link.'); } @@ -232,6 +233,7 @@ export default function CreateLink({ onClose, open, documentId }: CreateLinkProp string; handleExpirationChange: (event: React.ChangeEvent) => void; + handleBlur: (event: React.FocusEvent) => void; } const SharingOptionsAccordion = ({ @@ -25,6 +26,7 @@ const SharingOptionsAccordion = ({ isPasswordVisible, setIsPasswordVisible, expirationType, + handleBlur, handleExpirationChange, }: SharingOptionsAccordionProps) => { return ( @@ -77,7 +79,6 @@ const SharingOptionsAccordion = ({ mb={4} ml={13}>