fix(contacts): client-side inline validation for contact/company/site forms [MAPPS-177] #157

Merged
vas2000-work merged 2 commits from fix/MAPPS-177-contact-form-validation into main 2026-06-15 18:56:15 +02:00
Owner

What

Client-side counterpart to PMS-325: the contact, company, and site forms now validate phone, time zone, country, and postal code inline before submit, showing a per-field message instead of relying on a server error (MAPPS-177).

Changes

  • Shared helpers mirroring the server rules: validate_phone_field (normalize + E.164), validate_country_field (ISO 3166-1 alpha-2), validate_postal_field (permissive), validate_timezone_field (light IANA-shape check that catches the America/New York mistake).
  • Wired per-field inline errors via the existing Input { error } prop in the company form (phone, postal, country), the site modal (phone, time zone, postal, country), and the contact form (phone, mobile). Each form validates before submit and sends the normalized values.
  • Unit tests for the four helpers.

Manual UX pass

This issue also calls for a manual walkthrough of every contact/company field (per Yousif's note that automation misses UX/logic gaps). That is a human, in-browser step and is NOT covered by this PR; tracking it as a remaining checklist item on the issue.

Verification

  • cargo test --lib validation_tests green; cargo clippy --all-targets -- -D warnings, cargo fmt --all --check, cargo check --target wasm32-unknown-unknown clean.

Server-side validation (the 422 source) is PMS-325 (linked).

#MAPPS-177

## What Client-side counterpart to PMS-325: the contact, company, and site forms now validate phone, time zone, country, and postal code inline before submit, showing a per-field message instead of relying on a server error (MAPPS-177). ## Changes - Shared helpers mirroring the server rules: `validate_phone_field` (normalize + E.164), `validate_country_field` (ISO 3166-1 alpha-2), `validate_postal_field` (permissive), `validate_timezone_field` (light IANA-shape check that catches the `America/New York` mistake). - Wired per-field inline errors via the existing `Input { error }` prop in the company form (phone, postal, country), the site modal (phone, time zone, postal, country), and the contact form (phone, mobile). Each form validates before submit and sends the normalized values. - Unit tests for the four helpers. ## Manual UX pass This issue also calls for a manual walkthrough of every contact/company field (per Yousif's note that automation misses UX/logic gaps). That is a human, in-browser step and is NOT covered by this PR; tracking it as a remaining checklist item on the issue. ## Verification - `cargo test --lib validation_tests` green; `cargo clippy --all-targets -- -D warnings`, `cargo fmt --all --check`, `cargo check --target wasm32-unknown-unknown` clean. Server-side validation (the 422 source) is PMS-325 (linked). #MAPPS-177
fix(contacts): inline validation on contact, company, and site forms
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 2m27s
79347722d3
The contact, company, and site forms posted phone, time zone, country, and postal code with no client-side checks, so bad input only failed at the server and surfaced as a generic "request failed". Validate each inline before submit and show the message on the offending field, mirroring the PMS-325 server rules.

Add shared helpers: validate_phone_field (strip formatting, then E.164), validate_country_field (ISO 3166-1 alpha-2), validate_postal_field (2-12 char permissive), and validate_timezone_field (light IANA-shape check that catches "America/New York"). Wire per-field inline errors via the existing Input error prop in the company form (phone, postal, country), the site modal (phone, time zone, postal, country), and the contact form (phone, mobile); each form now sends the normalized values. Adds unit tests for the helpers. The manual UX walkthrough the issue also calls for is a human in-browser step and remains a checklist item.

#MAPPS-177

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Merge branch 'main' into fix/MAPPS-177-contact-form-validation
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 2m21s
c6803a2b20
vas2000-work deleted branch fix/MAPPS-177-contact-form-validation 2026-06-15 18:56:15 +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!157
No description provided.