I am having a form with 700 fields. Suppose if an user updates one or two fields, i want to update that particular fields in Database. My question is how to find that particular(modified) fields in server side, i dont want to execute update query to all the tables. I am using Jboss server, Java, Jsp & MySql
Try this basic approach:
First don't give name
attribute to the fields initially. Now when user edits the fields, using javascript give the name
attribute to the field. That is it ! On the server side you will always receive data in name=value pair, if there is no name
the browser won't pass the field value to the server.
EDIT:
Keep hidden fields with the old values but with no names. This will help you to test whether user has entered new value or not.
This is an example:
script
$(function(){
$(document).on('input', '.to-edit', function(e) {
var box = $(this);
var prv = box.prev().val();
var cur = box.val();
if ('' === cur || prv === cur) {
box.prop('name', '');
} else {
box.prop('name', 'txtName');
}
e.stopPropagation();
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.