Forms and safe submission
Field contracts, asynchronous validation, financial review, conflicts, offline behavior, and recoverable submission.
Start with the decision
Section titled “Start with the decision”A form should collect the minimum information needed for a valid business transition. Separate saving a draft from submitting for approval and from posting or paying. Show tenant, document identity, currency, and period before editable transactional details. The policies here are integration requirements, not evidence that every existing form implements them.
Group fields by the user’s decision: identity, transaction details, allocation, and review. Keep mandatory prerequisites visible before users spend time filling dependent fields. Reuse known customer, employee, and document data instead of requiring manual re-entry. Show the origin of inherited values and whether they can safely be overridden.
Field anatomy and actual API
Section titled “Field anatomy and actual API”BaseInput provides label, hint, info, error, required, and disabled around modelValue.
Its label uses a generated input ID; error or hint text is connected through aria-describedby.
When error is present, it replaces the displayed hint and sets aria-invalid.
Keep essential units and constraints in the persistent label or adjacent copy if they must remain during errors.
The component exposes focus(); use it for an error-summary link or deliberate first-invalid-field focus.
| Element | Do | Do not |
|---|---|---|
| Label | Name the business value and necessary unit | Use an example as the only label |
| Hint | Explain a non-obvious requirement before submission | Hide a posting constraint in hover-only help |
| Required state | Mark and explain required inputs consistently | Rely on a red asterisk with no shared explanation |
| Error | State the problem and a possible correction | Display a raw backend validation object |
| Read-only value | Explain its source and why it cannot change | Make it look editable but silently ignore edits |
| Optional value | Explain why supplying it is useful | Force invented data merely to satisfy a form |
Numeric and date safety
Section titled “Numeric and date safety”BaseInput with type="number" emits a JavaScript number when conversion succeeds and an empty string when cleared.
Do not treat this conversion as a decimal-money parser or an accounting precision guarantee.
Use the domain’s decimal/minor-unit contract and validate precision, range, currency, and rounding rules.
Do not silently round a material amount while keeping the original value visible.
Distinguish an accounting date from an event timestamp and state the applicable timezone for deadlines.
Reject impossible date combinations with actionable messages, such as a due date before the invoice date.
Relationship selection
Section titled “Relationship selection”Use SearchableSelect for large authorized option sets rather than loading the entire master-data table.
Its server fetch receives search and cursor parameters; optionLabel can resolve a selected value outside the loaded window.
Preserve a known selected label while new search results load; do not display a raw UUID as the normal experience.
Changing a parent value must invalidate incompatible dependent values with a visible explanation.
Creation through create and createPermission must follow the same authorization and validation as the full create page.
Do not enable free-form creatable values for controlled accounts, tax codes, or legal entities without a domain decision.
Validation timing
Section titled “Validation timing”Validate required and structural constraints locally, then enforce authoritative business rules on the server. Do not flash errors before a user has had an opportunity to enter the value. On submission, provide a summary for multi-field errors and associate each message with its field. Retain valid values and place focus deliberately; avoid moving it on every keystroke. For asynchronous uniqueness checks, cancel stale requests or ignore out-of-date responses. A late “available” response for an old value must never clear the current value’s error. A successful precheck is not a reservation: handle server-side uniqueness conflicts at save time.
Submission lifecycle
Section titled “Submission lifecycle”| State | Visible behavior | Safety responsibility |
|---|---|---|
| Editing | Clear draft state and enabled relevant controls | Track unsaved changes without leaking sensitive data |
| Validating | Explain checks that delay submission | Keep stale results from overwriting newer input |
| Sending | BaseButton :loading and stable action text | Prevent duplicate invocation; retain operation identity |
| Accepted for background work | Show queued/running state and a status destination | Do not claim processing is complete |
| Succeeded | Show the saved identifier and correct business state | Reconcile the server response and clear only saved changes |
| Failed | Persistent explanation plus appropriate feedback | Preserve safe input and offer a scoped retry |
| Unknown outcome | Explain uncertainty and offer status checking | Do not blindly repeat a payment or posting request |
Disabling a button is a UI guard, not idempotency; consequential writes need the backend contract. After a timeout, distinguish a rejected request from a request that may already have committed. If the server accepted a job, resume from its status rather than creating another job on refresh. Progress percentages require a real denominator; otherwise use truthful indeterminate progress.
Conflicts, permissions, and offline work
Section titled “Conflicts, permissions, and offline work”For a version conflict, show that the record changed, preserve safe edits, and offer comparison with the latest version. Never silently overwrite another user’s change or automatically retry with a new version number. If permissions change mid-edit, explain that saving is no longer allowed and avoid promising a successful retry. Do not keep a tenant-A draft active after switching to tenant B. Offline behavior must reflect actual capabilities: this guide does not promise an offline mutation queue. For payment, approval, and posting, require confirmed connectivity and status reconciliation before any retry. Avoid persisting payroll, bank, or identity data in browser storage as an unreviewed draft shortcut.
Review and confirmation
Section titled “Review and confirmation”Use ConfirmGate for consequential actions with explicit title, message, and action-specific confirmLabel.
Its requireText may add friction for exceptional irreversible operations, but is not authentication or authorization.
The inspected gate closes before emitting confirm; keep subsequent progress and errors in the parent view.
Present full amounts, currency, beneficiary, period, selection count, and reversal policy where relevant.
Do not require a destructive-looking confirmation for every harmless field edit.
Unsaved-change navigation should offer a clear choice; never claim a draft was saved without persistence evidence.
Acceptance criteria
Section titled “Acceptance criteria”- Keyboard-only users can enter values, resolve errors, review, submit, and recover.
- Both locales cover helper text, asynchronous checks, validation, and unknown outcomes.
- Duplicate clicks, timeout after commit, stale validation, version conflict, and permission loss are tested.
- Server validation, tenant scope, audit, and idempotency remain authoritative.
- Financial values retain precision and are never silently converted or rounded for convenience.
- Closing a dialog does not hide the only error or leave a mutation without visible status.
- Sensitive input preservation, navigation guards, and offline behavior are explicitly documented.
See feedback for message placement and accessibility for financial error prevention.