#3647 - Block AJAX loading
0 guests and 0 members have recently viewed this.
The top 3 point earners from 7th Dec 2025 to 14th Dec 2025.
| PDStig |
|
|
|---|---|---|
| Gabri |
|
|
| Master Rat |
|
|
There are no events at this time
1. Many calls to $dom.internaliseAjaxBlockWrapperLinks() had a wrong parameter name, sorry about this :(.
2. After fixing above, the "internalising" was only working once because when new HTML was loaded via AJAX, $dom.internaliseAjaxBlockWrapperLinks() wasn't getting called afterwards to attach event listeners to the new links and forms. This is because we got rid of inline <script> tags, we now use "behaviors" instead which are applied any time new HTML is inserted using $dom.* functions. They are called on an element using data attributes. So I added a behavior named [data-ajaxify-links] to fix this.
3. The on-change event listeners attached for triggering the form submit event were also lost when loading new HTML, this is where event delegation shines. I simply added a 'js-onchange-submit-form' class to the relevant elements and added this to the template function: $dom.on(container, 'change', '.js-onchange-submit-form', function (e, el) { $dom.trigger(el.form, 'submit'); });.
4. The submit event needed to be triggered on the form, not the input elements: $dom.trigger(el, 'submit'); -> $dom.trigger(el.form, 'submit');
So the main_staff_actions block is working now but other stuff using $dom.internaliseAjaxBlockWrapperLinks() is probably broken as well :(, testing/fixing that now.