js error on radiobuttons rendered as buttons grouped

Status
Not open for further replies.

lcollong

FabriKant d'applications web
got this error
elementlist.js:107 Uncaught TypeError: Cannot read properties of undefined (reading '_getSubElements')
at Object.<anonymous> (elementlist.js:107:39)
at HTMLFormElement.dispatch (jquery-3.6.0.min.js?8134c3d81f7aab475eac74c779894099:2:43064)
at v.handle (jquery-3.6.0.min.js?8134c3d81f7aab475eac74c779894099:2:41048)

which corresponds to this portion of the elementlist.js file :
JavaScript:
                        // As we are delegating the event, and reference to 'this' in the js will refer to the first element
                        // When in a repeat group we want to replace that with a reference to the current element.
                        elid = target.closest('.fabrikSubElementContainer').prop('id');
                        that = this.form.formElements[elid];
                        subEls = that._getSubElements();
                        if (target.length > 0 && subEls.contains(target[0])) {

                            // Replace this with that so that the js code runs on the correct element
sounds like 'that' is undefined at this moment.
The error raise on click event
 
Is this under investigation or should I try to solve it ?
It seems to break following js in some situations.
 
Just found it. Can you try (with Fabrik debugJS enabled)
media\com_fabrik\js\elementlist.js line 100 ff
Code:
                        if (target.prop('tagName') === 'LABEL') {
                            var for_id = target.prop('for');
                            if (for_id) target = jQuery("#"+for_id);
                            else target = target.find('input'); //old structure <label...> xy <input>...</label>
                        }
 
Yes ! It works without error now.
I'm almost at the end of my migration (with some hollidays in between !). A lot to do : custom code to refactor, css due to template move, css due to BS5 move... and some strange behavior with eval (form php plugin and/or calc togother with the use of static method in the custom fabrik helper class). Hard to reduce to a reproductible test case. Had to bypass the constructor initialization code from the custom_example.php file...
Thanks for your help. Fabrik seems almost fully ok.
 
Example files and WIKI are still from/for F3.
So please collect also such general custom code stuff to improve the update instructions.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top