This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I get an event fired through javascript?

 
Jayant Raj
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put the funciton call in your calendar code.

Eric
 
Jayant Raj
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic