Skip to content

Conversation

@bra-i-am
Copy link
Contributor

@bra-i-am bra-i-am commented Sep 9, 2025

This pull request introduces form validation and refactoring to the catalog editing workflow, ensuring that user input is validated before submission. The main changes include adding a Yup validation schema, integrating validation with React Hook Form, updating the UI to display error messages, and refactoring the modal to handle form submission.

Form Validation and Schema Integration

  • Added a Yup-based validation schema for the catalog edit form, enforcing rules such as required fields, minimum/maximum lengths, valid email/URL formats, and logical date ranges.
  • Implemented a custom hook useYupValidationResolver to connect Yup validation with React Hook Form, allowing for synchronous error handling and validation feedback. [1] [2]

UI and Error Feedback Enhancements

  • Updated the CatalogEditForm to display validation errors inline for each field, improving user feedback and form usability. [1] [2]
  • Expanded the messages.js file to include localized error messages for all validation scenarios.

Component Refactoring and Submission Handling

  • Refactored CatalogEditForm to use forwardRef and expose a submitForm method, enabling parent components to trigger form submission. [1] [2]
  • Modified useCatalogEditionModal to use a ref to the form and handle submission and modal closure based on validation results. [1] [2] [3] [4]

Type Definitions

  • Added a new CorporateCatalogForm type to restrict form fields to only those relevant for editing

Screenshots

image image

@bra-i-am bra-i-am marked this pull request as draft September 9, 2025 21:31
@bra-i-am bra-i-am marked this pull request as ready for review September 12, 2025 21:24
@bra-i-am bra-i-am marked this pull request as draft September 12, 2025 21:26
@bra-i-am bra-i-am marked this pull request as ready for review September 15, 2025 20:28
@bra-i-am bra-i-am requested a review from dcoa September 16, 2025 19:45
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

Successfully merging this pull request may close these issues.

2 participants