Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

multiple forms formData js

var a = new FormData(); // using additional FormData object
var b = [];             // using an array
for(var i = 0; i < document.forms.length; i++){
    var form = document.forms[i];
    var data = new FormData(form);
    var formValues = data.entries()
    while (!(ent = formValues.next()).done) {

        // Note the change here 
        a.append(`${ent.value[0]}[]`, ent.value[1])
    }
}
// here a will include all the data from all of your forms.
Comment

PREVIOUS NEXT
Code Example
Javascript :: node js command line interface 
Javascript :: Append to the text in the <p tag 
Javascript :: react-beforeunload react navive 
Javascript :: js create a auto call function inside function 
Javascript :: how to end a javascript program 
Javascript :: smtp testing 
Javascript :: react use component 
Javascript :: react js and graphql integration 
Javascript :: regex checker 
Javascript :: apartments api 
Javascript :: js filter text 
Javascript :: req.params 
Javascript :: react-redux todo list 
Javascript :: jsdoc object destructuring 
Javascript :: what hostings can run react js 
Javascript :: save item in array javascript 
Javascript :: object literals and array literals in javascript 
Javascript :: add property to object javascript 
Javascript :: how to uninstall nodejs web server 
Javascript :: what is an arrow function and how is it used in react 
Javascript :: jquery document ready deprecated 
Javascript :: merge two binary tree 
Javascript :: visual studio code json to one line 
Javascript :: angular2-tree-diagram 
Javascript :: react-bootstrap-table2-editor 
Javascript :: asynch action redux 
Javascript :: how to use javascript in django template 
Javascript :: javascript destructing 
Javascript :: constructor js 
Javascript :: js callback hell 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =