Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

on multiple events ...

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should only need onchange, was there a reason why you need onclick?

Eric
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic