Knob form updates

pull/3774/merge
Bahadır Sofuoğlu 2023-03-20 15:10:58 +03:00
parent f14b464048
commit 85b59958f7
1 changed files with 22 additions and 3 deletions

View File

@ -19,9 +19,14 @@ import { useField, useForm } from 'vee-validate';
export default {
setup() {
const { handleSubmit, resetForm } = useForm();
const { value, errorMessage } = useField('value', validateField);
const { value, errorMessage } = useField('value', validateField, {
validateOnValueUpdate: false
});
const toast = useToast();
value.value = 0;
function validateField(value) {
if (!value) {
return 'The value must be greater than zero.';
@ -34,6 +39,8 @@ export default {
if (values.value > 0) {
toast.add({ severity: 'info', summary: 'Form Submitted', detail: values.value, life: 3000 });
resetForm();
value.value = 0;
}
});
@ -71,9 +78,13 @@ import { useField, useForm } from 'vee-validate';
export default {
setup() {
const { handleSubmit, resetForm } = useForm();
const { value, errorMessage } = useField('value', validateField);
const { value, errorMessage } = useField('value', validateField, {
validateOnValueUpdate: false
});
const toast = useToast();
value.value = 0;
function validateField(value) {
if (!value) {
return 'The value must be greater than zero.';
@ -86,6 +97,8 @@ export default {
if (values.value > 0) {
toast.add({ severity: 'info', summary: 'Form Submitted', detail: values.value, life: 3000 });
resetForm();
value.value = 0;
}
});
@ -110,9 +123,13 @@ import { useToast } from 'primevue/usetoast';
import { useField, useForm } from 'vee-validate';
const { handleSubmit, resetForm } = useForm();
const { value, errorMessage } = useField('value', validateField);
const { value, errorMessage } = useField('value', validateField,{
validateOnValueUpdate: false
});
const toast = useToast();
value.value = 0;
function validateField(value) {
if (!value) {
return 'The value must be greater than zero.';
@ -125,6 +142,8 @@ const onSubmit = handleSubmit((values) => {
if (values.value > 0) {
toast.add({ severity: 'info', summary: 'Form Submitted', detail: values.value, life: 3000 });
resetForm();
value.value = 0;
}
});
<\/script>