473,480 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Possible to tell when a hidden field's value changes

Hi,

Is there a way to trigger an event when the value of a hidden field
changes? At a certain point in time my hidden field is getting
changed to a value that I don't want but I can't find a place in the
code where this is happening by doing a search for its variable name.

Thanks, - Dave
Oct 22 '08 #1
5 4224
On Oct 22, 8:06*pm, laredotornado <laredotorn...@zipmail.comwrote:
Hi,

Is there a way to trigger an event when the value of a hidden field
changes? *At a certain point in time my hidden field is getting
changed to a value that I don't want but I can't find a place in the
code where this is happening by doing a search for its variable name.
AFAIK, no, you can't trigger an event. A better way of finding the
rogue piece of code is to use a good tool like Firebug which allows
you to debug your Javascript app.

HTH,
/sasuke

Oct 22 '08 #2
On Oct 22, 11:06*am, laredotornado <laredotorn...@zipmail.comwrote:
Hi,

Is there a way to trigger an event when the value of a hidden field
changes? *At a certain point in time my hidden field is getting
No.
changed to a value that I don't want but I can't find a place in the
code where this is happening by doing a search for its variable name.
Search for what variable name? Sounds like you need to get acquainted
with your code.

Oct 22 '08 #3
In comp.lang.javascript message <2d0fc7a0-2427-46e5-a637-e0e3ae10cf0e@j2
2g2000hsf.googlegroups.com>, Wed, 22 Oct 2008 08:06:38, laredotornado
<la***********@zipmail.composted:
>
Is there a way to trigger an event when the value of a hidden field
changes? At a certain point in time my hidden field is getting
changed to a value that I don't want but I can't find a place in the
code where this is happening by doing a search for its variable name.
You have tried in browsers other than IE? Error reporting is nicer in
Firefox. You have tried changing the name/ID of the hidden variable?
You have read the FAQ and asked yourself why you don't say what
browser(s) the problem occurs in?

You could edit your code for test so that the value of the hidden field,
before the unwanted change, its value is stored in a [global] variable.
Further edit to put, at the end of each existing code statement, pseudo-
code like
if hidden != saved than alert(<linenumber>)
That should enable you to find where the change occurs, which is a step
towards finding why.

If the error only occurs somewhere in the middle of user actions, then
you could use setInterval to check very frequently whether a change had
occurred; that might help in associating it with some input action and
hence some part of the code.

Learning and using a good debugger is a good idea; but, for a one-off,
the above may be quicker, especially if you have a script-editor which
can auto-insert the test in suitable locations.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 22 '08 #4
laredotornado wrote:
Is there a way to trigger an event when the value of a hidden field
changes?
Yes.
At a certain point in time my hidden field is getting changed to a value
that I don't want but I can't find a place in the code where this is
happening by doing a search for its variable name.
A hidden field is no variable.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Oct 22 '08 #5
laredotornado wrote:
Hi,

Is there a way to trigger an event when the value of a hidden field
changes?
It would be useful to have a reliable way to subscribe to property
change events. It wouldn't seem to
be the best way to debug your issue, though.

Mutation events are fickle, but you could try it out. Try setting a
mutation event for DOMAttrModified[1]. Make a simple testcase for it.

myInp.addEventListener("DOMAttrModified", function(ev) {
console.log(ev);
}, true);
For IE, use the developer toolbar. Or, you can also try using an -
onpropertychange - handler[2].

myInp.onpropertychange = function() {
alert(this.value);
}
[1]
http://www.w3.org/TR/DOM-Level-2-Eve...mutationevents
[2] http://msdn.microsoft.com/en-us/libr...56(VS.85).aspx

At a certain point in time my hidden field is getting
changed to a value that I don't want but I can't find a place in the
code where this is happening by doing a search for its variable name.

Thanks, - Dave

--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
Oct 27 '08 #6

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

Similar topics

3
2179
by: Roy Adams | last post by:
Hi I'm reposting this question because for some reason can't post follow up question to this thread. What I'm trying to do is put the value and text from a a select in to a text field and to a...
8
4552
by: Fabri | last post by:
Is it possible, as IE does in Windows Update, to ask onbeforeunload if the user want really close window (or tab) clicking on close (X) of the window? This window isn't opened by window.open....
3
1884
by: Henke | last post by:
How can data be passed to the server when an event is fired in client-side jscript, ie on a drop event? I have tried using hidden fields and submitting the page, but for some reason I can't access...
2
4224
by: Rodusa | last post by:
I have a hidden field inside one datagrid which I can't get to make it keep its state after a postback event. Look field: <input type="hidden" id="TxtHiddenItem_id" name="TxtHiddenItem_id"...
7
4428
by: Andy | last post by:
Hi, I have a complicated question that I'm hoping someone can help me out with. I have a webpage that contains a plug-in. This plug-in can communicate/pass data with the webpage that contains it...
5
2740
by: dvwool | last post by:
Hello, Another newbie here... I've been trying to make this work for days now and have finally decided to post as I can't seem to get it to work. Here's what I'm trying to do... I have a...
10
6704
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
4
1884
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this...
1
1997
by: cerilocke | last post by:
I have a repeater in which I have a hidden field (input type = hidden), a textbox (asp:TextBox), a checkbox (input type = checkbox) and a label (asp:Label). I have bound all four items to the same...
0
7054
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
7057
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
7102
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...
1
6756
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
7003
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
5357
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,...
0
3000
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
199
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...

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.