473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Not allow submit if data changed

Using VS2005 and .Net 2.0
I want to be able to keep the user from moving to another web page if they
have selected the "Edit" link button on a FormView (or any view for that
matter), have changed any of the data in bound controls and do not click on
the "Update" link button. Can anyone help? Thanks.

David
May 10 '06 #1
3 1176
this is just simple javascript. create a variable that is updated on any
value changed (by attaching script to the onchange event of each control).

the following is air code

<body onunload="return doConfirm()" onsubmit="changesSaved =true;">
<script>
var changesSaved = true;
function doConfirm() {
if (changesSaved ) return window.confirm("You have not saved you
changes, cancel navigate?");
return true;
}
</script>
<input type=text onchange="changesSaved =false;">

note: at form load, with client script you could attach the onchange handler
(be sure to delegate any existing routines).

-- bruce (sqlwork.com)

"David" <dl*****@lifetimeinc.com> wrote in message
news:eS****************@TK2MSFTNGP05.phx.gbl...
Using VS2005 and .Net 2.0
I want to be able to keep the user from moving to another web page if they
have selected the "Edit" link button on a FormView (or any view for that
matter), have changed any of the data in bound controls and do not click
on the "Update" link button. Can anyone help? Thanks.

David

May 10 '06 #2
The textbox ia asp textbox so I have to set attribute in Sub Page_Load.
However, when I try to reference the control I get an error. The textbox is
in a FormView inside a EditItemTemplate section. How do I reference this
control in my VB sub? Thanks.

David

"bruce barker (sqlwork.com)" <b_*************************@sqlwork.com> wrote
in message news:O0**************@TK2MSFTNGP05.phx.gbl...
this is just simple javascript. create a variable that is updated on any
value changed (by attaching script to the onchange event of each control).

the following is air code

<body onunload="return doConfirm()" onsubmit="changesSaved =true;">
<script>
var changesSaved = true;
function doConfirm() {
if (changesSaved ) return window.confirm("You have not saved you
changes, cancel navigate?");
return true;
}
</script>
<input type=text onchange="changesSaved =false;">

note: at form load, with client script you could attach the onchange
handler (be sure to delegate any existing routines).

-- bruce (sqlwork.com)

"David" <dl*****@lifetimeinc.com> wrote in message
news:eS****************@TK2MSFTNGP05.phx.gbl...
Using VS2005 and .Net 2.0
I want to be able to keep the user from moving to another web page if
they have selected the "Edit" link button on a FormView (or any view for
that matter), have changed any of the data in bound controls and do not
click on the "Update" link button. Can anyone help? Thanks.

David


May 10 '06 #3
I think your doConfirm should be if (!changesSaved) ... correct?

David
"bruce barker (sqlwork.com)" <b_*************************@sqlwork.com> wrote
in message news:O0**************@TK2MSFTNGP05.phx.gbl...
this is just simple javascript. create a variable that is updated on any
value changed (by attaching script to the onchange event of each control).

the following is air code

<body onunload="return doConfirm()" onsubmit="changesSaved =true;">
<script>
var changesSaved = true;
function doConfirm() {
if (changesSaved ) return window.confirm("You have not saved you
changes, cancel navigate?");
return true;
}
</script>
<input type=text onchange="changesSaved =false;">

note: at form load, with client script you could attach the onchange
handler (be sure to delegate any existing routines).

-- bruce (sqlwork.com)

"David" <dl*****@lifetimeinc.com> wrote in message
news:eS****************@TK2MSFTNGP05.phx.gbl...
Using VS2005 and .Net 2.0
I want to be able to keep the user from moving to another web page if
they have selected the "Edit" link button on a FormView (or any view for
that matter), have changed any of the data in bound controls and do not
click on the "Update" link button. Can anyone help? Thanks.

David


May 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
6
by: Cro | last post by:
Dear Access Developers, The 'Allow Additions' property of my form is causing unexpected results. I am developing a form that has its 'Default View' property set to 'Continuous Forms' and am...
2
by: Luis Esteban Valencia | last post by:
I have a data grid control with a templated checkbox column residing in a asp.net user control. The checkbox boolean state determines if the item is later added or removed from another database...
5
by: awebguynow | last post by:
to submit or not to submit - that is the question and I'm going to be designing some lengthy forms, where many of the fields may be populated with data, and the user may only want to view it. ...
3
by: awebguynow | last post by:
in other words, Can I make client side mod's before I submit a form and Post ? I guess its just a matter of cycling through the form elements and setting value to null (or empty string) for...
5
by: ian | last post by:
Hi, I am currently using a Javascript function to dissallow the enter key on my ASP.NET (2.0) web page, as follows: function fnTrapKP(){ if (document.all) { if (event.keyCode == 13) {
3
by: Dabbler | last post by:
How do I tell wether I'm seeing autopostback vs submit button click in Page_load? Thanks for any clues.
5
by: Simon Benson | last post by:
Probably a fairly simple problem but one that's been plaguing me for a couple of days... can anyone help? I have a classic ASP page with a number of text boxes which are updatable. For...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.