Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (indicator types list): add extra form validation #450

Merged
merged 15 commits into from
Nov 28, 2024
Merged
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/pages/indicatorTypes/form/IndicatorTypesSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { getDefaults, createFormValidate, modelFormSchemas } from '../../../lib'
const { identifiable } = modelFormSchemas

export const IndicatorSchema = identifiable.extend({
factor: z.coerce.number().int(),
factor: z.coerce
.number({ invalid_type_error: 'Please enter a number' })
.int()
.min(1, 'Please enter a value above 0')
Chisomchima marked this conversation as resolved.
Show resolved Hide resolved
.max(
Number.MAX_SAFE_INTEGER,
`The number is too large. Please enter a valid integer.`
),
})

export const initialValues = getDefaults(IndicatorSchema)
Expand Down
Loading