Exclude or Omit field in submit #3638
-
Hi, @logaretm In the form, I have but no need to present in const { value: optionalFieldOne, errorMessage: optionalFieldOneErr } = useField('optionalFieldOne');
const { value: optionalFieldTwo, errorMessage: optionalFieldTwoErr } = useField('optionalFieldTwo');
const { value: mainFieldOne, errorMessage: mainFieldOneErr } = useField('mainFieldOne');
const { value: mainFieldTwo, errorMessage: mainFieldTwoErr } = useField('mainFieldTwo');
const onSubmit = handleSubmit((values, { resetForm }) => {
// only need mainFieldOne, Two Values
}, onInvalidSubmit); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
vee-validate will always retrieve the values "present" in the form data as long as they have been changed at least once. If you want to clean up the values you should do that on your own with lodash or any other utility you have. I don't think vee-validate should do this because, in the realm of custom components, any custom value can be "optional" like an empty string or the current date value. |
Beta Was this translation helpful? Give feedback.
vee-validate will always retrieve the values "present" in the form data as long as they have been changed at least once. If you want to clean up the values you should do that on your own with lodash or any other utility you have.
I don't think vee-validate should do this because, in the realm of custom components, any custom value can be "optional" like an empty string or the current date value.