ankur8819
Member • Nov 7, 2011
Capturing Field Update Event for a JSP
Hi,
I am working on a project where I need to do some task if any field is updated on a jsp.
One way could be take a hidden variable for every field which stores the previous value and then by comparing the previous value and the current value I can know if any field has been updated or not.
But keeping track of 20 fields on JSP like this is not neat. Also a part of JSP displays some fields that are displayed dynamically i.e. they come through a query .The number of rows returned by Select query determines the number of fields rendered on page,So when the page renders I will not know how many fields are there on JSP.
Other way that i thought of was
when the page has rendered create change event for every VISIBLE INPUT element except button in the DOM using JQUERY and if any one of the change event fires I set a variable which tells that any field has been updated.
Can anyone suggest some other approach that I can use?
Note that I need to do something in java if ANY field on the jsp is updated.
Thanks,
Ankur
I am working on a project where I need to do some task if any field is updated on a jsp.
One way could be take a hidden variable for every field which stores the previous value and then by comparing the previous value and the current value I can know if any field has been updated or not.
But keeping track of 20 fields on JSP like this is not neat. Also a part of JSP displays some fields that are displayed dynamically i.e. they come through a query .The number of rows returned by Select query determines the number of fields rendered on page,So when the page renders I will not know how many fields are there on JSP.
Other way that i thought of was
when the page has rendered create change event for every VISIBLE INPUT element except button in the DOM using JQUERY and if any one of the change event fires I set a variable which tells that any field has been updated.
Can anyone suggest some other approach that I can use?
Note that I need to do something in java if ANY field on the jsp is updated.
Thanks,
Ankur