I've got an event bound to the 'update-hierarchical-select' JS event. This event is fired for all select boxes in the HS widget except for the last one (i.e. the one without any children). I hacked around a bit to see if I could find another event being fired then, but it looks like there isn't.
I can see a couple of potential solutions for this. First would be to modify my module to bind to the 'change' event if the select box is the last in the series... although I'm not sure how to determine that. The second would be to have HS fire an event even if the item is the last in the series... although I'm thinking the 'update-hierarchical-select' event wouldn't be appropriate here. Thoughts?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 291626_1.patch.patch | 3.48 KB | wim leers |
Comments
Comment #1
wim leersRight, it's only fired when HS' HTML needs to be updated/redrawn. I guess "update" is somewhat ambiguous here.
Basically you're trying to act upon a change in the selection, right? And you don't want to have to handle the case where you need an AHAH callback to the server and no callback, right?
Then I suggest adding a 'change-hierarchical-select' event. This is the equivalent of a normal select's 'change' event. Maybe even just call it 'change'? But that might be confusing when you consider that this only applies to the hierarchical select part, not the dropbox part.
Patch atttached.
To test, use this piece of code:
$('#hierarchical-select-1-wrapper').bind('change-hierarchical-select', function() { console.log('yar'); });Note: While looking into this, I found 2 regressions and fixed them right away: http://drupal.org/cvs?commit=131814 and http://drupal.org/cvs?commit=131815.
Comment #2
jrbeemanThat patch did the trick! Verified as a fix.
Comment #3
wim leersYay, thanks for the review :) Committed!
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
hmdnawaz commentedHi
I have a simple problem of select change event.
I have a select field in .module file which contains a list forum titles. I want when i select a title from the select field, this title should display in a text box or simply display on the page. How could i do this?