Answer the question
In order to leave comments, you need to log in
Check the form - have any changes been made?
There is a large form like
text.field|text.field|checkbox|checkbox
...
Well, in general, editing a bunch of records from the database. How would you check whether changes were made in this line in any of the fields? And then every time to update all the records at once is somehow irrational. How would you mark this? JS on onclick somewhere to store id in a variable? Maybe somewhere smart that has already been written on this topic or who will throw an adequate thought?
Answer the question
In order to leave comments, you need to log in
Hang up a function on onChange that will fill the hidden input with the flag changed / not?
In any case, before writing, you will make one more selection - in order to check the existence of the element, check write permissions, and perform some security actions. You can compare the current data with the new ones in order to make a decision about the appropriateness of the update. If there is a lot of data, you can merge or serialize them and compare hashes, for example md5(implode()) - if there are changes, the hashes will be different.
So you answered your own question - save the original data in hidden inputs. You can, of course, check for changes on the server side, but why put extra load on the server, right?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question