File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes How to detect form element change Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to detect form element change" Watch "How to detect form element change" New topic

How to detect form element change

Suresh Kanagalingam
Ranch Hand

Joined: Aug 17, 2001
Posts: 82
I have a very large form (about 2000 rows, each row with 6 columns). The user can change the information in each cell and submit the changes to the server. Since the data is large I do not want to send all the data back to the server if it is not changed.
I did some test using javascript and I was able to create a hidden field next to a row each time a row got updated (by detecting an event in the cell), but this is a costly operation because I need to update the form with 2000 rows each time when a user changes something.
How can I track row (or cell) changes without updating the form each time when a change is made?
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
Form fields are posted by name. If the field does not have a name, it's value will not be sent. Initially, do not assign a name to the field, but assign an ID instead. Then, in the field's onChange event, assign the id value to the name.

[ December 12, 2003: Message edited by: Tom Blough ]

Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
The one thing we do in an application that has a lot of fields is we have a checkbox beside the line of code and when the information is chnage, we check the box. It can be done dynamcially or manually depending on the project.
When we submit the form to our server then we look for just the checked boxes.
Just thought I would guve my 2cents

I agree. Here's the link:
subject: How to detect form element change
It's not a secret anymore!