aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Onchange event will not fire 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 "Onchange event will not fire" Watch "Onchange event will not fire" New topic
Author

Onchange event will not fire

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1419
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

Joined: Jan 10, 2002
Posts: 61010
    
  65

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

And please make sure your code is well formated for display. Your post is barely legible.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1419
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

Joined: Jan 10, 2002
Posts: 61010
    
  65

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

Joined: Jul 05, 2009
Posts: 257
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


Experience and talent are independent of age
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1419
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
Can you modify the calendar code?

Eric
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1419
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Onchange event will not fire