File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How do I get an event fired through javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How do I get an event fired through javascript?" Watch "How do I get an event fired through javascript?" New topic
Author

How do I get an event fired through javascript?

Jayant Raj
Ranch Hand

Joined: Mar 11, 2004
Posts: 42
Hi Friends,

I have a text box 'myTxtBox' to which I have attached a calendar js. When I select a date from the calendar, it gets populated in the text box. But I also
have to call a function 'myFunc', when the value changes in the text box. But the function doesn't get called.

I think when you try to change the value of a text box through JavaScript, it only updates the DOM.

Please help me as to, how can I get the function called when the value of the text box gets changed through JS.

Thanks in advance for any help.
[ May 01, 2006: Message edited by: Bear Bibeault ]

regards,<br />Jayant Raj<br /> <br />SCJP 1.4 [98%]<br />SCWCD 1.4 [91%]<br />SCBCD [In Progress]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
put the funciton call in your calendar code.

Eric
Jayant Raj
Ranch Hand

Joined: Mar 11, 2004
Posts: 42
Hi Eric,

I thought about putting the function call in the calendar. It is a third party component, so I can't make any changes to that.

I will try explaining the problem, in more detail.

1] I have a calendar control & a read only text field.
2] The user selects a date & it gets populated in the text box.
3] Now since the value in the text box has changed, I make a asynchronous call to a function 'myFunc' using AJAX to validate the date.
4] For this I have a {onchanged = 'myFunc'} for my text box. But this onchanged method doesn't get called.

Please, try to give me some solution.. as I am not very comfortable with JS.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The function is not going to get called since the onchange is only fired with user interaction. Only thing you can dois build some sort of listener that has a timer on it that checks to see if the value is different.
Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I get an event fired through javascript?
 
Similar Threads
calling javascript function through onclick present on checkbox
Having trouble with javascript ...
Calling javascript function in js file from JSP
Form Input Box to validate a producer code and open a page on my website
pass a variable in the URl