How to request all the modified elements of the form?


The form contains many elements that are generated dynamically.

<c:foreach var="row" items="${rs0.rows}">
 <c:set var="SIGNIFICATIVE" value="${row.SIGNIFICATIVE}">
 <c:set var="ID_SIGNIFICATIVE" value="${row.ID_SIGNIFICATIVE}">
 </c:set></c:set></c:foreach><table class="table">

 <td> <input type="checkbox" id="${ID_SIGNIFICATIVE}" name="CHECKBOX_${ID_SIGNIFICATIVE}"></td> <td style="width:50%">${SIGNIFICATIVE}</td>
 <td><div class="input-group"><input type="text" class="form-control" id="${ID_SIGNIFICATIVE}" name="TEXT_${ID_SIGNIFICATIVE}"> <span class="input-group-addon">,%</span> </div></td>


Further information of these form elements should be recorded in the database.
Tell me by which method it is possible to obtain a list of changed form elements.
July 8th 19 at 12:10
2 answers
July 8th 19 at 12:12
it must be, therefore, there is requested the state of all form objects, plus the objects are filtered out of the form type ['checkbox', 'radio', 'button', 'submit']. and vars_for_update is added, only those for which there was a change

<script language="javascript">
 function GetValue () {
 var result = [];
 var vars_for_update="";
 []'form').elements, function (el) {
 if (['checkbox', 'radio', 'button', 'submit'].indexOf(el.type) === -1 ) // || el.checked
 //var elem =;
 var defValue = el.defaultValue;
 var currvalue = el.value;
 var index = el.selectedIndex;
 if (index) defValue = el.options[0].value;
 if (defValue == currvalue || index === 0) {
 result.push( + ':: '+ el.value+' :: '+" Value not changed");
 } else {
 result.push( + ':: '+ el.value+' :: '+" Value changed from " + defValue +
 "\n " + currvalue); + '==' + el.value+"<>;";
 demo.innerHTML = result.join('<br>');
 if (vars_for_update!="") {
July 8th 19 at 12:14
All form values can be retrieved by using the jQuery method .serializeArray().
Look like there all sold and do on js.

If you are interested in getting ONLY the changed data after editing each field to write modified data to the object database and to send only this data.

This can be realized like this:
Hang a listener to change the content on each field and when the event record values in the object.
Send pzhl. an example of such implementation - Lyric.Bosco commented on July 8th 19 at 12:17
js or jQuery? - Felix_Sawayn commented on July 8th 19 at 12:20
if possible, both - Lyric.Bosco commented on July 8th 19 at 12:23

Find more questions by tags JavaJSPJava servletsComputer networksJavaScript