Skip to content

fix(tasks): validate task forms before submission - #10

Merged
armnkumar321-spec merged 1 commit into
armnkumar321-spec:mainfrom
adityamukesh:feature/issue-4-form-validation
Oct 12, 2026
Merged

armnkumar321-spec merged 1 commit into
armnkumar321-spec:mainfrom
adityamukesh:feature/issue-4-form-validation

Conversation

@adityamukesh

Copy link
Copy Markdown
Contributor

Summary

Validate create and edit forms before submission. Display accessible inline errors, focus the first invalid field, and prevent invalid forms from calling onSubmit.

Allow retrying failed saves and return users to /tasks after successful creation or editing.

Closes #4.

Changes

  • Reject blank or whitespace-only titles.
  • Enforce the backend-aligned limits of 120 characters for trimmed titles and 2,000 characters for trimmed descriptions.
  • Allow an omitted due date and reject invalid calendar dates.
  • Connect inline errors using aria-invalid and aria-describedby.
  • Clear field errors when corrected.
  • Trim valid text before submission.
  • Prevent duplicate submissions while saving.
  • Reset the submitting state after server errors so users can retry.
  • Navigate to /tasks after successful saves.

Before

Before form validation fix

Submitting a whitespace-only title calls onSubmit and displays no inline validation error.

After

After form validation fix

The same submission displays “Task title is required,” provides accessible error feedback, and does not call onSubmit.

These images visualize actual React test results; they are not app screenshots.

Validation

  • Frontend production build passed.
  • Frontend lint passed with existing warnings.
  • 19 targeted form/page checks passed, covering:
    • Invalid submission prevention.
    • Title and description length limits.
    • Optional and invalid dates.
    • Error correction and accessibility.
    • Valid create/edit submissions.
    • Pending-submission prevention.
    • Server-error retry and successful navigation.
  • All 16 unchanged backend API tests passed.

Browser smoke testing remains unverified because the preview environment was blocked.

Scope

Backend validation remains unchanged. Admin assignment in issue #5 is outside this PR. No new production dependencies or code comments were added.

@armnkumar321-spec
armnkumar321-spec merged commit db6f7eb into armnkumar321-spec:main Oct 12, 2026
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.

[Bug] Add client-side task form validation

2 participants