Detecting values that have changes on a post back

S

Simon Harvey

Hi all,

Is there any easy way to check a field for calues that have changed on a
post back.

So the page is sent to the user, the user changes some values and I need to
know which ones changed.

Is the only way to do this to go through all the fields and check them
against their old values. In which case, would I need to store the values in
the session object so I could tell what the old values were?

This sounds a bit messy so I'm hoping there is some easier way.

Any help would be greatfully received

Thanks everyone

Simon
 
C

Charlie Nilsson [MSFT]

Search on google for "javascript dirty flag", or something similar. Some
sites use an OnChange attribute in the html input fields, and set a
variable for each field indicating whether than field has been altered.

Basically, each field has its own hidden field, with an initial value=0.
Each input field has its own OnChange event that sets its relative hidden
field value to 1. When the form posts back you just check the hidden
fields to see what changed.

It's not a great solution, but sometimes desirable.

--
CharlieN
VSU

This posting is provided "AS IS" with no warranties, and confers no rights.

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top