fix(tickets): flag every missing required field on new-ticket submit (PMS-514) #348
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-514-ticket-form-validate-all-required"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes PMS-514: on the new-ticket form (
TicketNewPage,src/pages/tickets.rs), submitting with both Title and Company empty surfaced only the company error; the empty title was not flagged.Root cause
handle_submitparsed the company UUID first andreturned immediately on failure, before the client-side title check ran. With the company missing, the early return prevented the POST, so the server never validated the blank title and the inlinetitle_errorslot stayed empty. The title was only ever flagged when the company was valid (the request reached the server, which rejected the blank title).Fix
Validate both required fields up front and bail once, instead of short-circuiting on the company check:
title_error = "Title is required."when the trimmed title is empty.error = "Please pick a company first."when the company UUID does not parse.is_submitting.set(false); return;) without POSTing if either failed -company_uuid.filter(|_| !title_empty)isSomeonly when both pass, so thelet Some(..) elsefires if either field is invalid.Both slots are set before the return, so missing-both renders both messages (title inline, company at the top). Reuses the form's existing
"Title is required."wording (MAPPS-281) rather than the issue's suggested second wording, to avoid introducing two messages for the same condition. The server-side title validation stays as a backstop; a valid submit is unchanged.Verification
just checkparity via the rust-builder image:cargo clippy --all-targets -- -D warningsclean,cargo fmt --checkclean,cargo check --target wasm32-unknown-unknownclean.Behaviour walkthrough:
Docs
dev-docs/form-conventions.md: new "Required-field validation" section codifying the report-every-required-field convention for all create/edit forms.PMS-A-4("Mokosh form validation: the required-field 'report everything' convention") documents the convention and the PMS-515 gap.Acceptance criteria