From 22f5f8e18bdb690d98eb789a3bd019e3c4da315f Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Tue, 22 Oct 2024 09:31:03 +0300 Subject: [PATCH] AutoComplete Form doc --- apps/showcase/doc/autocomplete/FormDoc.vue | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) 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 }); } }