Skip to content

Commit

Permalink
Set RadioList, Autocomplete input components to not trigger validatio…
Browse files Browse the repository at this point in the history
…n onMounted
  • Loading branch information
wilwong89 committed Jan 2, 2025
1 parent 2e392c7 commit 4a6a314
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion frontend/src/components/form/AutoComplete.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { useField, ErrorMessage } from 'vee-validate';
import { onMounted } from 'vue';
import { AutoComplete } from '@/lib/primevue';
Expand Down Expand Up @@ -38,7 +39,11 @@ const {
// Emits
const emit = defineEmits(['onChange', 'onComplete', 'onInput']);
const { errorMessage, value } = useField<string>(name);
const { errorMessage, value, resetField } = useField<string>(name);
onMounted(() => {
resetField({ touched: false });
});
</script>

<template>
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/form/RadioList.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { ErrorMessage, useField } from 'vee-validate';
import { watch } from 'vue';
import { onMounted, watch } from 'vue';
import { RadioButton } from '@/lib/primevue';
Expand All @@ -21,12 +21,16 @@ const {
const emit = defineEmits(['onChange', 'onClick']);
// State
const { errorMessage, value } = useField<string>(name);
const { errorMessage, value, resetField } = useField<string>(name);
// Actions
watch(value, () => {
emit('onChange', value.value);
});
onMounted(() => {
resetField({ touched: false });
});
</script>

<template>
Expand Down

0 comments on commit 4a6a314

Please sign in to comment.