[SOLVED] how to check that any form field data is changed or not?

Issue

i am working on a asp.net web app in this application when customer logged in then his/her

personal details displayed in form fields (e.g. full name in name box ,age in age box etc) for getting data first i fetch the data from ms sql then assign them to ICustomer interface properties this interface is implemented by customer class.

And we also have a update button on customer information page so if without changing any information if a user click on update then unnecessary it will go to server and come back and the same data updated in database,so what i am trying to do is to just detect whether something changed in customer form then only update functionality should work.

i have two option

  1. just use Java script and detected the text change then unable update button.
  2. make a temporary reference of ICustomer and compare it to the older when then process by making something true or false.

so please suggest me the best approach for it or any other method.

if question is unclear then just comment on it i will explain more.

Solution

JavaScript may help you, but it’s very unreliable. I say go with the second option. Store the ICustomer object in a Session variable and compare it with the new one.

Answered By – Tomislav Markovski

Answer Checked By – Terry (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *