feat(kb): migrate KB article + category forms to FormGuard (PMS-518) #353

Merged
nrupard merged 1 commit from feat/PMS-518-migrate-kb-forms into main 2026-06-25 20:35:24 +02:00
Owner

What

Next per-page increment of the PMS-515 form-validation migration (PMS-518). Migrates the KB Article create/edit form and the KB Category modal onto the shared FormGuard.

Changes

  • KB Article (KBArticleEditPage::handle_submit): Title and Body were hand-validated with the first-failure-masks-the-second bug (Title checked first, returned before Body). Both now go through guard.field(...) into their own inline slots (title_error / content_error), so a missing Title no longer hides a missing Body and the first invalid field is focused. Each field gains rules: vec![Rule::Required] for on-blur validation. The form-level banner is kept for server save errors.
  • KB Category modal: the single required Name routes through the guard into a name_error inline slot, for consistency.
  • Both keep the value they send (the Article body is sent untrimmed to preserve Markdown; only the required-check is trimmed).

Behaviour

  • KB Article: submit with empty Title + Body -> both errors show at once (inline), first focused, no POST. Previously only "Title is required." showed.
  • Messages clear as fields are corrected (blur + live).

Verification

just check parity via the rust-builder image: clippy --all-targets -- -D warnings, fmt --check, cargo check --target wasm32-unknown-unknown - all green.

Part of PMS-518 (multi-PR). Progress is tracked in dev-docs/form-validation-audit.md (updated as batches land; this PR is code-only to avoid a doc conflict with the in-flight new-ticket/log-time PR #352).

## What Next per-page increment of the PMS-515 form-validation migration (PMS-518). Migrates the **KB Article** create/edit form and the **KB Category** modal onto the shared `FormGuard`. ## Changes - **KB Article** (`KBArticleEditPage::handle_submit`): Title and Body were hand-validated with the first-failure-masks-the-second bug (Title checked first, `return`ed before Body). Both now go through `guard.field(...)` into their own inline slots (`title_error` / `content_error`), so a missing Title no longer hides a missing Body and the first invalid field is focused. Each field gains `rules: vec![Rule::Required]` for on-blur validation. The form-level banner is kept for server save errors. - **KB Category** modal: the single required Name routes through the guard into a `name_error` inline slot, for consistency. - Both keep the value they send (the Article body is sent untrimmed to preserve Markdown; only the required-check is trimmed). ## Behaviour - KB Article: submit with empty Title + Body -> both errors show at once (inline), first focused, no POST. Previously only "Title is required." showed. - Messages clear as fields are corrected (blur + live). ## Verification `just check` parity via the rust-builder image: `clippy --all-targets -- -D warnings`, `fmt --check`, `cargo check --target wasm32-unknown-unknown` - all green. Part of PMS-518 (multi-PR). Progress is tracked in `dev-docs/form-validation-audit.md` (updated as batches land; this PR is code-only to avoid a doc conflict with the in-flight new-ticket/log-time PR #352).
feat(kb): migrate KB article + category forms to FormGuard (PMS-518)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 19m30s
Create release / Create release from merged PR (pull_request) Has been skipped
41375fb701
Next per-page increment of the PMS-515 migration. Moves the KB Article create/edit form and the KB Category modal onto the shared FormGuard.

KB Article (KBArticleEditPage handle_submit): Title and Body were validated by hand with the first-failure-masks-the-second bug (Title checked first, returned before Body). Both now go through guard.field(...) into their own inline error slots (title_error / content_error), so a missing Title no longer hides a missing Body; the first invalid field is focused. Each field gains rules: vec![Rule::Required] for on-blur validation. The form-level error banner is kept for server save errors.

KB Category modal: the single required Name now routes through the guard into a name_error inline slot, for consistency with the other migrated forms.

Both forms keep the value they actually send (Article body is sent untrimmed to preserve Markdown; only the required-check is trimmed).

just check parity (rust-builder image): clippy --all-targets -D warnings, fmt --check, cargo check --target wasm32-unknown-unknown all green.

#PMS-518
nrupard scheduled this pull request to auto merge when all checks succeed 2026-06-25 20:19:13 +02:00
nrupard deleted branch feat/PMS-518-migrate-kb-forms 2026-06-25 20:35:24 +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!353
No description provided.