V4 - How to set InitialValue dirty? #3919
Unanswered
PineappleAttack
asked this question in
Q&A
Replies: 2 comments 2 replies
-
You can use const { resetField } = useField(name);
onMounted(() => {
resetField({ value: 'new value' });
}); |
Beta Was this translation helpful? Give feedback.
1 reply
-
As far as I understand, you want to set a value for a field, and this field should then be So instead of The field value before |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
we have a custom input field ( with Vue 3 and VeeValidate4) and store our value in a pinia store. In that store is already an value and should fill the input field.
<InputControl v-model="store.lastname"/>
This work really well, but now we want to set the field with an initialValue to dirty. Has somebody an hint, how we can do that?
We tried handleChange in onMounted but even that, doesn't help.
Update 09-09
We have tried it again and this works for now (not the prettiest solution):
onMounted(() => { if (modelValue?.value !== undefined && modelValue.value !== null && modelValue.value !== ''){ handleChange(modelValue.value) } })
const {errorMessage, value, handleChange, meta} = useField(name, rulesLocal, { validateOnValueUpdate: false })
Beta Was this translation helpful? Give feedback.
All reactions