November 30, 2019

August 11, 2019

FormData.delete() and FormData.set() do not support Internet Explorer

Problem: All methods of FormData do not work/compatible with Internet Explorer. The only method that is successful is 'append'. but suppose you want to override values of specific keys but in that scenarios 'set' and 'delete' methods will not work on Internet Explorer.

Solution: You may use below code that will work on IE.

var form = $('form')[0];
var formData = new FormData();

var inputs = form.getElementsByTagName('input'); //for input box

var inputsList = Array.prototype.slice.call(inputs);
inputsList.forEach(
  function (i) {
     if (i.name !== 'excludedName') {
          formData.append(i.name, i.value);
     }
   }
);
formData.append('excludedName', 'value you want to set');

Note: for 'select' and 'textarea' use: 
var selects = form.getElementsByTagName('select');
var textareas = form.getElementsByTagName('textarea');

Disclaimer

We shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its response or damage to your system. We do not guarantee that the integrity or security of this communication has been maintained or that this communication is free of viruses, interceptions or interferences. Anyone communicating with us by email accepts the risks involved and their consequences. We accept no liability for any damage caused by any virus transmitted by this site.