How to track which form fields have made changes


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
4 views
How can I track which fields were changed in the form then in PHP script to handle the whole form, and only those fields which have been changed or to pass into the script is processing only the fields with changes.

P. S.: in the form of a sufficiently large number of fields
by | 4 views

3 Answers

0 like 0 dislike
Write a wrapper that will deal with the comparison of the obtained values from the source.
\r
You can still try such a perverted way:
JS on the client side collects information about changed fields and then the submit handler is hung, which sends only the changed fields.
\r
But the essence does not change much...
by
0 like 0 dislike
There is a fairly simple method, although not very beautiful: when the form is loaded for editing all fields are given with name="old_<field name>", and onkeydown old_ with the name of the field is removed. I.e. with "correct" names go, only the changed fields.
\r
But correct all the same to send only the changed content, tracking changes and sending the form via JS.
by
0 like 0 dislike
Something like this —
\r
\r... \r\rfunction PreSubmit(form) {\rfor (var i = 0; i < form.elements.length; i++)\rif (form.elements[i].defaultValue == form.elements[i].value)\rform.elements[i].removeAttribute("name");\r}\r\r
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
24,725 users