diff --git a/apps/showcase/doc/autocomplete/FormDoc.vue b/apps/showcase/doc/autocomplete/FormDoc.vue index 914a171ef..e40a59ea1 100644 --- a/apps/showcase/doc/autocomplete/FormDoc.vue +++ b/apps/showcase/doc/autocomplete/FormDoc.vue @@ -21,26 +21,22 @@ export default { data() { return { defaultValues: { - country: '' + country: { name: '' } }, countries: null, filteredCountries: null, resolver: null, schema: z.object({ - country: z.string().refine((val) => val.name !== '', { - message: 'Please select a country.' + country: z.object({ + name: z.string().min(1, 'Country cannot be empty.') }) }), code: { basic: `
- - {{ $form.username.errors[0]?.message }} -
-
- - {{ $form.email.errors[0]?.message }} + + {{ $form.country.errors[0]?.message }}
@@ -95,10 +91,8 @@ const value = ref(null); } }, 250); }, - onFormSubmit(x) { - console.log(x); - - if (x.valid) { + onFormSubmit({ valid }) { + if (valid) { this.$toast.add({ severity: 'success', summary: 'Form is submitted.', life: 3000 }); } }