fix(forms): reject whitespace-only required fields client-side (MAPPS-281) #289

Merged
YousifShkara merged 1 commit from fix/MAPPS-281-whitespace-required-trim into main 2026-06-21 07:13:33 +02:00
Owner

The Contact form's first_name / last_name and the New Ticket form's title carried HTML5 required, which accepts any non-empty string - including " ". A whitespace-only submit passed the browser check, reached the server, and surfaced a raw 422 banner with no field-level error. Trim the value at submit time and set the inline field error instead so the user sees which field failed at the source. The Company form already trims via validate_name_field, so no change needed there. Other forms have not been migrated yet (audit follow-up tracked under MAPPS-282 / MAPPS-284 since the failure mode overlaps).

#MAPPS-281

The Contact form's `first_name` / `last_name` and the New Ticket form's `title` carried HTML5 `required`, which accepts any non-empty string - including \" \". A whitespace-only submit passed the browser check, reached the server, and surfaced a raw 422 banner with no field-level error. Trim the value at submit time and set the inline field error instead so the user sees which field failed at the source. The Company form already trims via `validate_name_field`, so no change needed there. Other forms have not been migrated yet (audit follow-up tracked under MAPPS-282 / MAPPS-284 since the failure mode overlaps). #MAPPS-281
fix(forms): reject whitespace-only required fields client-side (MAPPS-281)
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 3m15s
Create release / Create release from merged PR (pull_request) Has been skipped
b1ca568e84
The Contact form's `first_name` / `last_name` and the New Ticket form's `title` carried HTML5 `required`, which accepts any non-empty string - including \"   \". A whitespace-only submit passed the browser check, reached the server, and surfaced a raw 422 banner with no field-level error. Trim the value at submit time and set the inline field error instead so the user sees which field failed at the source. The Company form already trims via `validate_name_field`, so no change needed there. Other forms have not been migrated yet (audit follow-up tracked under MAPPS-282 / MAPPS-284 since the failure mode overlaps).

#MAPPS-281
YousifShkara deleted branch fix/MAPPS-281-whitespace-required-trim 2026-06-21 07:13:33 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
psa-systems/mokosh-apps!289
No description provided.