Skip to content

[DEV-3702] Enhance validation and error handling in SignUpForm and ProfileDataCard#2119

Merged
marcobottaro merged 25 commits intomainfrom
DEV-3702-signup-and-profile-fields-validators
Mar 20, 2026
Merged

[DEV-3702] Enhance validation and error handling in SignUpForm and ProfileDataCard#2119
marcobottaro merged 25 commits intomainfrom
DEV-3702-signup-and-profile-fields-validators

Conversation

@Sebastiano-Bertolin
Copy link
Copy Markdown
Collaborator

This pull request introduces improved validation and error handling for profile and sign-up forms, focusing on name fields and maximum character limits. The main changes include new validation logic, error messaging, and UI updates to display validation errors to users.

List of Changes

Validation and error handling improvements:

  • Added a new validateName function to enforce stricter rules for name fields, including allowed characters and a maximum length of 50 characters. Also updated validateField to check for empty values and a maximum length of 100 characters.
  • Updated the sign-up form and profile data card to use the new validation functions, ensuring that errors are displayed with specific messages for invalid names and overlong values.
  • Introduced an error prop to ProfileDataCardItem and RequiredTextField components, allowing error messages to be shown directly under the relevant input fields.
  • Updated UI logic in profile editing to clear errors when fields are corrected and reset errors when cancelling edits.
  • Added new localised error messages for maximum length and name validation in both English and Italian message files.

UI and code quality updates:

  • Fixed typo in input prop from maxlength to maxLength for consistency with React standards.
  • Improved error display logic in RequiredTextField to show helper text and error state only when appropriate.
  • Added debug logging for error values in form components to aid development.

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@Sebastiano-Bertolin Sebastiano-Bertolin self-assigned this Mar 5, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: 861c876

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nextjs-website Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Sebastiano-Bertolin Sebastiano-Bertolin marked this pull request as ready for review March 5, 2026 16:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves client-side validation and error display for sign-up and profile editing flows, with stricter name rules and max-length enforcement.

Changes:

  • Added validateName and extended validateField with max-length checks.
  • Wired validation + inline error messaging into SignUpForm, ProfileDataCard, and input components.
  • Added new localized error strings (EN/IT) and fixed maxLength prop casing.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
apps/nextjs-website/src/messages/it.json Adds localized max-length and name-validation error messages (IT).
apps/nextjs-website/src/messages/en.json Adds localized max-length and name-validation error messages (EN).
apps/nextjs-website/src/helpers/auth.helpers.ts Adds validateName; updates validateField to enforce trimmed non-empty + max length.
apps/nextjs-website/src/components/organisms/Auth/SignUpForm.tsx Applies new validators and displays field-level errors, including role.
apps/nextjs-website/src/components/molecules/RequiredTextField/RequiredTextField.tsx Adds an external error prop support and helper text behavior changes.
apps/nextjs-website/src/components/molecules/ProfileDataCard/ProfileDataCard.tsx Adds validation on save, tracks per-field errors, clears errors on cancel/edits.
apps/nextjs-website/src/components/atoms/InfoCardItem/ProfileDataCardItem.tsx Passes error state into fields; fixes maxLength prop casing.
.changeset/eight-chicken-teach.md Adds changeset entry describing the feature work.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sebastiano-Bertolin and others added 2 commits March 10, 2026 15:25
…/RequiredTextField.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ataCardItem.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/RequiredTextField.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 20, 2026

Jira Pull Request Link

This Pull Request refers to the following Jira issue DEV-3702

@marcobottaro marcobottaro merged commit bac3db7 into main Mar 20, 2026
14 checks passed
@marcobottaro marcobottaro deleted the DEV-3702-signup-and-profile-fields-validators branch March 20, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants