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

Check if field value is modified

75
Hi All,
I have a text field in my HTML page which has a value stored in it.

I need a java script code to allow the user to save if the content of the text field is edited.ie User should be prompted with a message on clicking the button
Displaying the "Content of the field is Edited".

Please help me in this regard as it will be help ful for my project completion?

Thanks in Advance!!!!!!!!!
Sep 23 '07 #1
4 3690
pbmods
5,821 Expert 4TB
Heya, ananth.

Simply store the previous value in the Element object (or a global variable, if you prefer) as the User edits it, then compare it to the current value when the User clicks the button.
Sep 23 '07 #2
Logician
210 100+
Hi All,
I have a text field in my HTML page which has a value stored in it.

I need a java script code to allow the user to save if the content of the text field is edited.ie User should be prompted with a message on clicking the button
Displaying the "Content of the field is Edited".
Read the element's defaultValue property.
Sep 23 '07 #3
ananth
75
Heya, ananth.

Simply store the previous value in the Element object (or a global variable, if you prefer) as the User edits it, then compare it to the current value when the User clicks the button.

Hi pbmods,
Thanks for your reply ,but do you have any sample code on how to implement it.Any sample code or website links would be of more helpful to me.
Sep 26 '07 #4
dmjpro
2,476 2GB
Hi pbmods,
Thanks for your reply ,but do you have any sample code on how to implement it.Any sample code or website links would be of more helpful to me.
Have a look at this!
Expand|Select|Wrap|Line Numbers
  1. <body onload = store()>
  2. <input type = text id = text1 value = "some_value">
  3. <input type = button value = "Check" onclick = "check()">
  4. </body>
  5.  
Expand|Select|Wrap|Line Numbers
  1. var prev_value = "";
  2. function store()
  3. {
  4.  prev_value = document.getElementById('text1').value
  5. }
  6. function check()
  7. {
  8.  var cur_value = document.getElementById('text1').value 
  9.  if(cur_value != prev_value) alert("Value changed");
  10.  else alert("Value not changed");
  11. }
  12.  
Good Luck!

Kind regards,
Dmjpro.
Sep 26 '07 #5

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

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
10
by: Clive Backham | last post by:
I tried posting this on comp.infosystems.www.misc, but that group appears to get very little traffic. So now I'm trying here. If there is a more appropriate group, please let me know. I'm...
1
by: A P | last post by:
Hi! Is there a way where I can identify if the field sent was modified? Me
5
by: Steve Wylie | last post by:
I am constructing an HTML questionnaire and one of the questions requires people to rate some choices from 1 to 5, where 1 is their favourite and 5 is their least favourite: Car Bus Taxi cab...
2
by: JC Mugs | last post by:
I have a form that when you tab from field to field that the entry point is blank, but if you point and click in the field it brings up a 0 and data entry is started to the left of the zero. ...
3
by: mike | last post by:
I'm writting a q&a chat application and hae a small refeshing IFRAME to check if there has been a new or modified chat item written, if so the main chat window refreshes and the datagrid gets...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
13
by: PhpCool | last post by:
Hi, since sometime I'm stuck in a problem where I want to check or uncheck all the checkboxes. If I'm choosing name for the checkbox array as 'chkbx_ary' then I'm able to check/uncheck all the...
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: 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
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.