472,374 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,374 software developers and data experts.

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 1910
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Amy | last post by:
Hi, I'm suddenly getting this error when I post back from my application. the application worked once, i added some code on one page (customizing a datagrid), and suddenly I'm getting this...
3
by: Jarod_24 | last post by:
How do i check if a sql-string has corect syntax. With select-statements you can just use a Datareader, since no data is changed in the database, but i'm working with other statements as well,...
6
by: RSB | last post by:
Hi Every one Need some help to Validate the Date i have in the Form. ALso how to Convert the Date Data i read from table to yyyy/MMM/dd format. Thanks RSB
0
by: tascienu | last post by:
This problem is happening sporadically. I have a reason then to believe it's not a problem with my server. Anyone knows the reason why? Some users are submitting successfully others are not.....
4
by: Wysiwyg | last post by:
I need to validate a form to ensure that all of the fields add up correctly. I can't do this while the user is entering data since validation needs to be done after the entry is completed. What's...
9
by: B-Dog | last post by:
I have a form that has about 10 text boxes on it, they all have to be filled out before submitting is there a quick way to make sure that none are null or do I have to call out each textbox? Say...
2
by: juventusaurabh | last post by:
I have a form with a number of fields, some of which would be filled(populated) automatically from the MS SQL database on certain event.Now, I have certain validations on the fields from sql...
2
by: Bob | last post by:
I know how to use php/mysql, but the html aspect of what Im trying to do (if its even possible this way) is what Im unsure of. I want to have a button that a user can hit to valid mysql info...
3
by: Jeff | last post by:
I know how to use php/mysql, but the html aspect of what Im trying to do (if its even possible this way) is what Im unsure of. I want to have a button that a user can hit to valid mysql info...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.