Submit only dirty values

Learn how to selectively submit dirty values.

We can filter elements which values should be submitted using formData:

vue
<Vueform :form-data="(form$) => {
  let formData = {}

  // Select only dirty elements
  Object.values(form$.elements$).forEach((el$) => {
    if (!el$.isStatic && el$.dirty) {
      formData = {
        ...formData,
        ...el$.requestData,
      }
    }
  })

  // Use `formatData` if defined
  if (form$.options.formatData) {
    formData = form$.options.formatData(formData)
  }

  // Add `formKey` if defined
  if (form$.formKey) {
    formData.formKey = form$.formKey
  }

  // Convert our data to `FormData` object
  return form$.convertFormData(formData)
}" />
  
👋 Hire Vueform team for form customizations and developmentLearn more