473,763 Members | 6,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Verify Changed Items

Hi,

Is it possible to verify, using js, if ANY item in a form has changed?

For example: I have a <form> with multiple items (<input>, <select>,
<textarea>, etc). I need to track if one (or more) of this items has
changed by a user.

One option, is to put a onChange event in each one of these fields
and, if the event occurs, I will update a hidden input to indicate
that something changed on the form.

But, the problem is that my form is big, and I was wondering if I
could check this situation by invoking something like
if(document.for m[0].changed)...

Is it possible?

TIA,

Bob
Jul 20 '05 #1
2 3000
In article <aa************ *************@p osting.google.c om>,
bo*******@pobox .com enlightened us with...
Hi,

Is it possible to verify, using js, if ANY item in a form has changed?

Yes.
For example: I have a <form> with multiple items (<input>, <select>,
<textarea>, etc). I need to track if one (or more) of this items has
changed by a user.

One option, is to put a onChange event in each one of these fields
and, if the event occurs, I will update a hidden input to indicate
that something changed on the form.

But, the problem is that my form is big, and I was wondering if I
could check this situation by invoking something like
if(document.for m[0].changed)...

Is it possible?


No, not like that.
Before the user does anything, have the script loop through the form
elements and save the values to an array or other structure (I'd use an
array and make the index be the same as the form element index for easy
compare later). When the user goes to submit or when you want to check,
loop again and compare the values.

That's assuming there is a reason you don't want to just use onChange.
Using onChange will not catch if a user changes a value then changes it
back to its original value (thus it wasn't really changed).
-------------------------------------------------
~kaeli~
The secret of the universe is @*&^^^ NO CARRIER
The more ridiculous a belief system, the higher
the probability of its success.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #2
bo*******@pobox .com (Bob Rivers) wrote in message news:<aa******* *************** ***@posting.goo gle.com>...
Hi,

Is it possible to verify, using js, if ANY item in a form has changed?

For example: I have a <form> with multiple items (<input>, <select>,
<textarea>, etc). I need to track if one (or more) of this items has
changed by a user.

One option, is to put a onChange event in each one of these fields
and, if the event occurs, I will update a hidden input to indicate
that something changed on the form.

But, the problem is that my form is big, and I was wondering if I
could check this situation by invoking something like
if(document.for m[0].changed)...

Is it possible?

TIA,

Bob


Just for the archive collections...

I received two good sugestions: one from Jim that controls the events
that have occured in the form.

And another solution from Kaeli that suggests to store the field
values into an array, using the onLoad and then when I leave the page,
compare the values againg with the one stored.

I decided to use Jim's solution.

Thanks everybody,

Bob
Jul 20 '05 #3

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

Similar topics

2
2430
by: Vilmar Brazăo de Oliveira | last post by:
Hi, How verify type or extension of file using ASPUPLOAD? I check documentation, but I didn't find anything else yet. thanks, -- ««««««««»»»»»»»»»»»»»» Vlmar Brazăo de Oliveira Desenvolvimento Web
2
3424
by: Brennon Arnold | last post by:
I have a problem that I figured would be relatively common, but have been unable to find any information on it as of yet. I have a page that contains two DropDownList controls, with the second being dependent on the value of the first. My DropDownList control definitions look like this: <asp:dropdownlist id="ddlLocCty" runat="server" CssClass="SmlBox" AutoPostback="True" CausesValidation="False"></asp:dropdownlist> <asp:dropdownlist...
6
1609
by: johnt | last post by:
i am looking for help on how to verify information in a form so that the following info has to be filled in before they click on submit. I am not an expert in java or html so any help would be greatly appreciated. Name Address City State Zip
23
5093
by: Han | last post by:
Our app runs on end-users machines (apache2.x + php5). At this moment it is quite easy for someone (who has access to the console) to insert a couple lines of php code to steal sensitive info. Is there a way to check the integrity of the php and javascript code by using digital signatures/simple hash/etc. ? What do you do to verify that your code has not been changed by someone else and everything is leaked to a rogue site?
1
16529
by: losway | last post by:
Hi everyone, Firstly i would like to thank everyone for their help and suggestions. However, i still could not fulfil my boss request. Here what i need to do: Original: SQL> set verify on SQL> define myv = 100
6
6505
by: Valerian John | last post by:
I have a ListBox webcontrol on an aspx page. Items are added to the ListBox using client-side code. However, when the page is posted back the items are missing/not available. (It is like the page does not know the items were added client-side.) TIA, Val
2
8703
by: Andy Chen | last post by:
Hi, I have to verify a lot of installation packages which are digital signed. You can verify a file on the property sheet, but I am working on southands of files. I am planning to create a tool to do this work. Anybody have some ideas about this? Andy
11
5815
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
2
1221
by: =?Utf-8?B?SmFzb24gQmFybmV0dA==?= | last post by:
I've created a component that inherits from ComboBox. Wiithin its constructor, I've hardcoded some initial items that I'd like added. These items are of a custom class. When I add my control to a Form, the code-behind file contains code for each item. This seems unecessary and causes items to be added more than once (first, because of my ComboBox constructor; again, because of the code-behind items). I suspect that there may be a...
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.