I have a database structure with an one to many relationship. In the html form, there are similar inputs with a name \'item[]\' or \'file[]\' to make the data to be an array
You could solve this with jQuery and add a class on every changed input
Than you can disable all inputs
without the class and submit the form
$(document).ready(function() {
$('input, select, textarea').on('change', function() {
$(this).addClass('changed');
});
$('form').on('submit', function() {
$('input:not(.changed), textarea:not(.changed)').prop('disabled', true);
// alert and return just for showing
alert($(this).serialize().replace('%5B', '[').replace('%5D', ']'));
return false;
});
});
You could use indexes in the name attribute like this