469,279 Members | 2,271 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,279 developers. It's quick & easy.

Detecting a change on a hidden field

Claus Mygind
571 512MB
How do you get a trigger/event to fire on a hidden field. In this case I have a hidden field that is updated via a script. It seems when a field is updated in this manner none of the event triggers like "onChange" "onSelect" "onBlur" will fire.

Is there some script based way this can occur?

Currently I add code to every method I use to update a field from script. But I have a number on methods that does this, and I do not wish to go into each of them and add code that the field has been changed. I am looking for some way for the field to detect that something changed.
Mar 25 '08 #1
2 3090
hsriat
1,654 Expert 1GB
How do you get a trigger/event to fire on a hidden field. In this case I have a hidden field that is updated via a script. It seems when a field is updated in this manner none of the event triggers like "onChange" "onSelect" "onBlur" will fire.

Is there some script based way this can occur?

Currently I add code to every method I use to update a field from script. But I have a number on methods that does this, and I do not wish to go into each of them and add code that the field has been changed. I am looking for some way for the field to detect that something changed.
I think you might be changing the hidden input's value with JavaScript, as its not possible otherwise.

So just after you change the value of the field, in the next line, execute the code which you want to execute onchange.
Mar 25 '08 #2
Claus Mygind
571 512MB
I think you might be changing the hidden input's value with JavaScript, as its not possible otherwise.

So just after you change the value of the field, in the next line, execute the code which you want to execute onchange.
You are correct. I am changing value via scripts (note plural). I did not want to have to change every script that updates the value of the field. I wanted the field to detect the change and fire the event, the same as if the user had made the change.

I have an add/edit/delete screen. On it I have several methods for the user to fill the form elements i.e. they can type in the field, they can use one of my search methods which open sub-windows for lookup purposes where they can select a record which is then backfilled on the calling screen via script. I am now adding ajax communication which goes out to look for the next 30 records which can be used by the user for browsing. So as you see there are a number of ways to fill the field. But only the user input (typing in the field) will trigger the onChange. And of course on my previous search methods I use script to mark the change. I was just hoping for a single point to capture any change that occurred regardless of the method of change.

Is that possible?
Mar 25 '08 #3

Post your reply

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

By using this site, you agree to our Privacy Policy and Terms of Use.