How Can I Get All The Data From A Summited Form And Make That Into A New List April 12, 2023 Post a Comment I want to take all the data submitted and make it into a list ( -item: bannana -itemNum: #3330...) Item: Solution 1: just one line: let formInputs = Object.fromEntries( new FormData(myForm).entries() ) Copy see FormData in context: myForm = document.querySelector('#myForm') myForm.onsubmit = evt => { evt.preventDefault() // disable submit page reload console.clear() let formInputs = Object.fromEntries( new FormData(myForm).entries() ) console.log( formInputs ) }Copy body, textarea, input { font-family : Helvetica, Arial sans-serif; font-size : 12px; } label { font-size : 1.2em; display : block; float : left; clear : both; width : 10em; white-space : nowrap; overflow : hidden; font-weight : bold; padding-top : .7em; line-height: 1.4em; } label:after { content : '....................................'; font-weight : normal; color : lightslategray; } input { display : block; float : left; width : 5em; margin : .3em; } button { display : block; float : left; clear : both; margin-top : .6em; } .as-console-wrapper { max-height:100% !important; top:0; left:50% !important; width:50%; } .as-console-row { background-color: yellow; } .as-console-row::after { display:none !important; }Copy <form id="myForm" action=""> <label> Item:</label> <input name="item" type="text" > <label> Item numbers:</label> <input name="itemNum" type="number" > <label> Quantity:</label> <input name="quantity" type="number" > <label> Price:</label> <input name="price" type="number" > <label> Discount:</label> <input name="discount" type="number" > <button type="submit">Submit</button> </form>Copy Share Post a Comment for "How Can I Get All The Data From A Summited Form And Make That Into A New List"
Post a Comment for "How Can I Get All The Data From A Summited Form And Make That Into A New List"