473,401 Members | 2,127 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,401 software developers and data experts.

How do you alert the user that they have unsaved changes in a form?

1
I have a php form with several text fields which retrieve the data from a selected record in my database. I would like that if the user edits the data in the fields in some way, and tries to leave the page by clicking a link, clicking the back button or refreshing the page, they would be prompted that they have made changes to form and that they must verify if they want to leave the page or not.

Any help is much appreciated.
Jan 16 '13 #1
1 2466
acoder
16,027 Expert Mod 8TB
Use the onbeforeunload event. See, for example, the following article: http://bytes.com/topic/javascript/in...vascript-event

You may want to keep a "dirty" variable which is set to false initially and when any changes are made, trigger a function in the above event.
Jan 16 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: IVer Erling Årva | last post by:
I have a frameset where one frame contains a menu and the other the screens where the contents change depending on what the user clicks in the menu. Is there any relatively easy way to give the...
0
by: katheo via AccessMonster.com | last post by:
Hello, I am using a data access page on a local secure server. As the user changes information, the data updates automatically in the database. But when the user goes to close the page, they get a...
2
by: adbarnet | last post by:
Hi, I'm a C++ developer coming fresh to c# for GUI development. For the project I'm working on, I need a specialised control (a treeview derivative) which would be very useful in other...
0
by: Tone Curtis | last post by:
I have a set of webforms where I need to prompt the user to "Save Changes". I can handle this to a degree within the form but if the user presses the Back button or selects the Home button the data...
4
by: markalroberts | last post by:
Hi, I wish to ask warn the user that there are unsaved changes (if there are) and allow them to cancel navigating away/closing the browser. Investigation leads me to believe the...
1
by: mkhmer | last post by:
Hello, I want to have my site able to alert User and then Disconnect all current user from accessing the pages for website maintenance purpose. If anyone have any idea of this aiming? ...
0
by: =?Utf-8?B?RWl0YW4=?= | last post by:
Hello, I created a Modal form (WinForm). I would like to prevent the user from moving the form around on the screen. How would I do that? Thanks, EitanB
2
by: muddasirmunir | last post by:
i am using vb6 i want to restirct user to close a form if it has a blank field for e-g if user did not write name is the box and he tries to close the form by clicking on the croos button at...
3
by: sillyr | last post by:
Hi I have a form where i have a dropdown box. The user selects either: No Yes-Observer Yes-Technician The table (LU Observer Present Lookup) that is used for the dropdown box has three fields:...
2
by: Deekay | last post by:
I have an unbound single record form (Access 2003) that is used as a container to collect user input (name, usergroup and dates) through combos bound to three different tables. A button then...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.