Improve error message, particularly on the user card edit page

This commit is contained in:
Kalle
2026-07-11 14:50:13 +03:00
parent 659bd6509f
commit 3aa95753f2
17 changed files with 18 additions and 2 deletions

View File

@@ -241,7 +241,7 @@ export function numberField(
) {
return z.coerce
.number()
.int()
.int({ message: "forms:errors.mustBeWholeNumber" })
.nonnegative()
.register(formRegistry, {
...args,
@@ -270,7 +270,7 @@ export function numberFieldOptional(
) {
return z.coerce
.number()
.int()
.int({ message: "forms:errors.mustBeWholeNumber" })
.nonnegative()
.optional()
.register(formRegistry, {

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "This field is required",
"errors.minLength": "Must be at least {{min}} characters",
"errors.maxLength": "Must be at most {{max}} characters",
"errors.mustBeWholeNumber": "Must be a whole number (no decimals)",
"errors.invalidUrl": "Must be a valid URL",
"errors.notAllowedCharacters": "Contains not allowed characters",
"errors.atLeastOneOption": "At least one option must be selected",

View File

@@ -58,6 +58,7 @@
"errors.required": "Este campo es obligatorio",
"errors.minLength": "Debe tener al menos {{min}} caracteres",
"errors.maxLength": "Debe tener como máximo {{max}} caracteres",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "Debe ser una URL válida",
"errors.notAllowedCharacters": "Contiene caracteres no permitidos",
"errors.atLeastOneOption": "Debe seleccionarse al menos una opción",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "",
"errors.minLength": "",
"errors.maxLength": "",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "",
"errors.notAllowedCharacters": "",
"errors.atLeastOneOption": "",

View File

@@ -58,6 +58,7 @@
"errors.required": "此项为必填项",
"errors.minLength": "字数不能少于 {{min}} 个字符",
"errors.maxLength": "字数不能多于 {{max}} 个字符",
"errors.mustBeWholeNumber": "",
"errors.invalidUrl": "请输入有效的 URL 地址",
"errors.notAllowedCharacters": "包含非法字符",
"errors.atLeastOneOption": "请至少选择一个选项",