Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Onchange event will not fire

 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code that pulls up a custom calendar control. The user clicks a date and the calling form is changed but the Onchange event does not fire.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The onchange event will only be triggered if the value is changed by user input. It will not be called if the value is changed under script control.

By the way, what's with the "javascript:" prefixes?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please make sure your code is well formated for display. Your post is barely legible.
 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The onchange event will only be triggered if the value is changed by user input. It will not be called if the value is changed under script control.

By the way, what's with the "javascript:" prefixes?


Somewhere along the way I picked up examples of the events having the javascript: prefix. If it is not necessary I will stop doing it.

Is there a remedy for my onchange situation?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64830
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:Somewhere along the way I picked up examples of the events having the javascript: prefix. If it is not necessary I will stop doing it.
Yes, stop. That's only necessary when putting script in an href (not recommended).

Is there a remedy for my onchange situation?

Depends upon what you are trying to do.

Again, please fix your posted code to not cause the window to span a few football fields.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the onchange event would fire ONLY when the field loses focus after editing of its value. Here it does not seem to lose focus.
If you can edit the getCalendar method, you can call the textbox's onblur event bu that would be totally silly coz if you can do that... you can actually put your code of onchange there. Makes more sense.

Regards
 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Depends upon what you are trying to do.



On my page I have several table rows of data. One prticular column holds a text box with date in it, another column holds a value that indicates wheather or not the row has been modified. When the user clicks the date text box a calendar form pops up for them to select a date from. The calendar form closes and changes the value of the text box which called it.

Now my challenge is to set the modify column cell to 1 if the date changes.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you modify the calendar code?

Eric
 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:Can you modify the calendar code?

Eric


Yes. I got it working by having the Calendar code fire a script back on the calling page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic