Skip to content

Is possible to change Yup validation schema on runtime? #4533

Closed Answered by jankrnavek
jankrnavek asked this question in Q&A
Discussion options

You must be logged in to vote

Its weird but I have to pass computed properties without .value part into useForm()
Now everything works like a sharm.

So correct code is:

const generateFormDefauls = computed(() => {
...
}

const generateFormDefauls= computed(() => {
...
}

const {
	meta,
	errors,
	values,
	handleSubmit,
	handleReset,
	resetForm,
	setFieldValue,
	setFieldError,
	isSubmitting,
} = useForm({
	validationSchema: generateFormSchema,
	validateOnMount: false,
	initialValues: generateFormDefauls,
})

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jankrnavek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants