The attached patch adds a "beforeSend" trigger along with passing settings through to each trigger, so that they can take advantage of the defined data within them.

Comments

wim leers’s picture

No patch!

jrbeeman’s picture

StatusFileSize
new1.7 KB

Whoops - sorry about that! Patch attached.

wim leers’s picture

Status: Needs review » Needs work

Looks good, except for 1 thing: this will *not* trigger "before <some event>" events for the update hierarchical select event when the cache is being used! (See line 335.) Is that for a specific reason?

wim leers’s picture

I'm just going to add a "before update hierarchical select from cache" event, that should be all you could ever want.

UPDATE
I'm going to drop this proposed event because it doesn't make much sense, typically you want to do something before an event because that event is going to take some time (i.e. AJAX requests to the server most of the time). But in the case of the cache, that's simply not true.

wim leers’s picture

And instead of passing the settings, which are VERY minimal (animationDelay and cacheId, if using a cache), I'm going to pass the hsid.

wim leers’s picture

Title: Add beforeSend JS trigger and pass settings through to triggers » Add "before" JS triggers and pass hsid through
Status: Needs work » Fixed
StatusFileSize
new2.4 KB

Patch attached and committed.

jrbeeman’s picture

Status: Fixed » Active
StatusFileSize
new1.94 KB

Been toying with how this works now, and I think the settings variable need to be passed through in order for some behaviors to be possible.

For example: The module I'm writing needs to know the value of the selected item in the hierarchy. The HSID tells me which hierarchical select block was modified, but that doesn't help me figure out the value of the particular select box that just changed (at least, not without writing a bunch of additional stuff to parse through the select boxes within it). The settings variable contains the property "select_id", which gives the HTML ID attribute for the select box that triggered the event.

The attached patch restores this functionality - but if there's some other way to get what I'm after, please let me know.

wim leers’s picture

Title: Add "before" JS triggers and pass hsid through » Add "before" JS triggers and pass hsid and settings through
Status: Active » Fixed

Agreed :)

Committed!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.