Skip to content

feat(ui): inline form validation errors — red border + inline text (v1.17 E) - #45

Merged
argszero merged 1 commit into
mainfrom
feat/ui-ue-deep-polish-2-inline-validation
Aug 17, 2026
Merged

argszero merged 1 commit into
mainfrom
feat/ui-ue-deep-polish-2-inline-validation

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Rant 2026-08-17T16:57:17 (UI/UE 多角度深化优化), item E — 表单行内校验错误: invalid input should show a red border on the field plus an inline error message below it (small red text), cleared automatically when the user corrects the input — instead of only a toast.

Changes

  • Reusable helpers in ui/js/app.js:
    • setFieldError(input, msg) — adds .input-error (red border) and inserts a .field-error span (red small text) after the field; auto-clears on input event;
    • clearFieldError(input) — removes border + text; called when opening/resetting forms.
  • Applied to all rant-named forms (提交失败不再仅依赖 toast,聚焦首个错误字段):
    • 充值金额 (#topup-custom): 请输入大于 0 的充值点数
    • 申请加额 (#raise-amount / #raise-reason): 请输入正整数申请点数 / 请填写申请原因
    • 部门表单 (#dept-form-name / #dept-form-quota): 请输入部门名称 / 请输入正整数月分配点数 / duplicate-name 部门「X」已存在
    • 共享上架表单 (#sf-key / #sf-quota): API Key required / 请选择厂商 / Plan / 模型并填写有效额度
  • CSS: .input.input-error (red border, incl. select), .field-error (block red small text);
  • Docs: docs/user-stories.md v1.17 changelog adds item E; ui/README.md 行内校验错误约定 section.

Acceptance

Invalid inputs show red border + inline error text on all four forms; typing clears them.

Tests

  • node --check on app.js — syntax OK
  • Field-error smoke test (DOM stub, 5/5 PASS): raise empty amount → inline error + red class; typing clears; dept empty name → inline error; topup invalid → inline error
  • DOM-stub init smoke — no ReferenceError
  • cargo test — 1 passed
  • cargo fmt --check — clean

@argszero
argszero merged commit ac431c4 into main Aug 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant