aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes on multiple events ... 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 "on multiple events ..." Watch "on multiple events ..." New topic
Author

on multiple events ...

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have a series of cascading selects, now shown listbox fashion with several rows visible instead of dropdown style. Using onclick events I'm happily clicking up and down my hierarchy with the mouse.

I'd also like to support keyboard navigation, so I hooked up onchange to the very same event handlers. That works fine for keyboard but when I mouse click a change both events fire and all my AJAX stuff runs twice.

I can't take out onlick and rely on onchange because ... take a deep breath ... as you click on any part of the hierarchy two things happen: the next listbox fills with child nodes AND the bottom half of the page shows the object at that level. Sometimes I click in box1, box2, box3, and box4 and view the lowest level leaf. Then I click back on the current row in box2 and want to see the object at that level again. onclick does it perfectly but onchange doesn't fire.

Any thoughts on supporting both without running twice?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You should only need onchange, was there a reason why you need onclick?

Eric
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Clicking a box to the left of the most recently clicked, even clicking the currently selected row, causes the bottom half of the page to change. And causes the boxes to the right to deselect.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Wouldn't the current row that is highlighted already have the data loaded for it?

If some reason that is not the case, add a filler row to force the user to seelct it.

If you want to go this route of two event handlers, you would have to do something to say, hey I am processing already.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on multiple events ...