473,385 Members | 1,983 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,385 software developers and data experts.

Script to test if values changed on form?

Hi All,

I'm wondering if anyone can point me to a javascript that will prompt a
user if they want to lose changes when they've edited one of several
fields on a form and are now navigating away from the page without
clicking submit?

If it makes any difference, the user will be viewing via Firefox 1.5 (I
know this, because I'm the user ;-).

Any help appreciated!

Much warmth,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org

May 22 '06 #1
3 1638
planetthoughtful wrote:
Hi All,

I'm wondering if anyone can point me to a javascript that will prompt a
user if they want to lose changes when they've edited one of several
fields on a form and are now navigating away from the page without
clicking submit?

If it makes any difference, the user will be viewing via Firefox 1.5 (I
know this, because I'm the user ;-).


There is a thread here that should help:

<URL:http://groups.google.co.uk/group/comp.lang.javascript/browse_frm/thread/4abeb36823fba5a9/b093cf498a4f9f6e?q=test+form+changed&rnum=1#b093cf 498a4f9f6e>
--
Rob
Group FAQ: <URL:http://www.jibbering.com/faq/>
May 22 '06 #2
Damn - that just left me more confused. Unfortunately, when I Google I
tend to find results for form validation. Whereas, I just want to be
able to prompt if a value has been edited but not submitted.

I'll keep looking - thanks Rob.

Much warmth,

planetthoughtful
---
"lost in thought"
http://www.planetthoughtful.org1

May 23 '06 #3
planetthoughtful said the following on 5/22/2006 8:21 PM:
Damn - that just left me more confused. Unfortunately, when I Google I
tend to find results for form validation.
Did you find anything when Googling the archives about quoting what you
are replying to?

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
Whereas, I just want to be able to prompt if a value has been edited
but not submitted.


That is precisely what the thread Rob pointed you to deals with - how to
tell if a form field has been changed or not. You check to see if
anything in the form has been changed. If it has, then you prompt. If it
hasn't, then you don't prompt.

Since you are wanting to check it before leaving the page, you look into
onunload of the window object.

Onsubmit of the form, you set a variable that the unload checks for. If
the form is submitted, you don't prompt.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 23 '06 #4

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

Similar topics

10
by: Don | last post by:
I want the server-side php script to return a browser page that is essentially a copy of the original client page that contained the <form> which referenced the php script in the first place....
4
by: Semi Head | last post by:
Hello folks, I'm looking for a script to validate a specific number value in a standard form input field. An example would be, if someone enters a number into a form input, I want the script to...
5
by: Mirovk | last post by:
The onclick action associated to my formīs radio buttons call to a vbscript were the session values are changed, this happens correctly but with the onclick action associated to my continue button...
9
by: Jerim79 | last post by:
I am no PHP programmer. At my current job I made it known that I was no PHP programmer during the interview. Still they have given me a script to write with the understanding that it will take me a...
1
by: muchexie | last post by:
i have two scripts that are not running to reset a password that has been forgotten and the other to change old password. here are the scripts. change_passwd.php <? ...
2
by: muchexie | last post by:
i have two scripts that are not running to reset a password that has been forgotten and the other to change old password. here are the scripts. change_passwd.php session_start();...
15
by: webstormcomputers | last post by:
I'm trying to update a hidden field with java script and I'm only getting one of the values from my select stament. Here is the code below. <select name="on0"> <option value="25">25 <option...
12
by: Ste | last post by:
Hi there, I've got a website with a list of Frequently Asked Questions, so there's a question and answer in a long list down the page. Can anyone recommend a simple script that would allow me...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...

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.