469,573 Members | 1,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

Validate Changed Data Before Submitting

Hello,

I've read somewhere that you can validate form data
before actually submitting it, similar to what validation
controls would do. For example, I have a form that has 2
textboxes. I populate the 2 textboxes with values from
the database. I also have an update button that will
update the values. If I have not made any change to the
data in the textboxes, then I do not want to submit the
data when the update button is clicked. I want to be able
to display a message that says data has not changed. Is
there a way to do this using viewstate or caching the
data.

Thanks,
Nov 18 '05 #1
1 1852
Viewstate is encrypted data that is viewable only on the server. So, you
have two options:

1. Store the current values in either viewstate or a session variable, then
do a comparison on postback to determine if they have changed prior to
updating the database.
2. Run a javascript on the client on the page load event that stores the
current value of these text boxes. Then, have an <input type="button"
onClick="reviewAndSubmit()"> that calls the reviewAndSubmit function
(JavaScript) which compares the current values to the original values, and
if they are different submit, otherwise redirect.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Johnny" <ti********@hotmail.com> wrote in message
news:58****************************@phx.gbl...
Hello,

I've read somewhere that you can validate form data
before actually submitting it, similar to what validation
controls would do. For example, I have a form that has 2
textboxes. I populate the 2 textboxes with values from
the database. I also have an update button that will
update the values. If I have not made any change to the
data in the textboxes, then I do not want to submit the
data when the update button is clicked. I want to be able
to display a message that says data has not changed. Is
there a way to do this using viewstate or caching the
data.

Thanks,

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jarod_24 | last post: by
6 posts views Thread by RSB | last post: by
reply views Thread by tascienu | last post: by
4 posts views Thread by Wysiwyg | last post: by
9 posts views Thread by B-Dog | last post: by
2 posts views Thread by juventusaurabh | last post: by
2 posts views Thread by Bob | last post: by
3 posts views Thread by Jeff | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.