GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Trigger an event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Trigger an event" Watch "Trigger an event" New topic
Author

Trigger an event

Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175
Hi,
If I have an input text field, when I click the text field, a small window is popped up. When I click an elememt in this popup window, a value is assigned to the text field programatically.
In this case, how can I trigger an event when the value of the text field is changed, assuming that I do not trigger an event from the popup window.


Thanks,<br />Mike
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
The best way, if your popup window will not assign value to the element directly, but will call some function on an opener, that will do that.
For example, if now inside popup window:
opener.form.element.value = "aaa",
it should be setValue(opener.form.element.value,"aaa");
and in your main window you put your change handling into this function.
If, for some reason, you can not do that, you could have a function that checks, does value of a sertain element changed, and constantly call it using setInterval().
 
GeeCON Prague 2014
 
subject: Trigger an event