[Vuejs]-Remove null from textfield and textarea using vue.js

0👍

As per your comment, It could be small issue with your data. null is coming as string so you just need to add a small check before adding data to the form.

Try like this.

Object.keys(response.data).forEach(key => {
   if (response.data[key] && response.data[key] !== 'null') {
       this.form[key] = response.data[key]
   }
})

Note: This will add all the properties of response.data to the form.

Leave a comment