Support Forum
Support › Meta Box Conditional Logic › Conditional logic 1.6.1 - JavaScript ErrorResolved
Hello, first I'd like to start by saying I am super excited about these speed improvements.
However, upon updating, I now get the following JS error in the console (as an aside, the version number of the js file still reflects version 1.5 in the PHP).
Uncaught TypeError: $field.closest is not a function
at getFieldScope (conditional-logic.js?ver=1.5:265)
at conditional-logic.js?ver=1.5:211
at Array.forEach (<anonymous>)
at isLogicCorrect (conditional-logic.js?ver=1.5:200)
at Object.<anonymous> (conditional-logic.js?ver=1.5:308)
at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=4.9.8:2)
at Object.<anonymous> (conditional-logic.js?ver=1.5:301)
at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=4.9.8:2)
at runConditionalLogic (conditional-logic.js?ver=1.5:300)
at init (conditional-logic.js?ver=1.5:513)
<code></code>
Which is referring to this block of code:
function getFieldScope( $field ) {
// If the current field is in a group clone, then all the logics must be within this group.
var $groupClone = $field.closest( '.rwmb-group-clone' );
if ( $groupClone.length ) {
return $groupClone;
}
// Global scope.
return '';
}
<code></code>
I haven't had a chance to dig deeper into that yet, but it is breaking the clonability of my metaboxes in almost every location where they are used.
Thanks!
Hi FED,
Thanks for your feedback. I've just fixed it and released new version. Can you please try again?
Thanks! Now it seems my nested conditionals aren't behaving, but cloning is much faster!!
This is the console error:
conditional-logic.js?ver=1.5:342 Uncaught TypeError: conditions.forEach is not a function
at getWatchedElements (conditional-logic.js?ver=1.5:342)
at init (conditional-logic.js?ver=1.5:521)
at conditional-logic.js?ver=1.5:528
at dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.8:3)
at r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.8:3)
Referring to this block:
// Outside conditions.
conditions.forEach( function ( logics ) {
logics.forEach( function ( logic ) {
if ( typeof logic.when === 'undefined' ) {
return;
}
logic.when.forEach( addWatchedElement, null );
} );
} );
Hi,
I've fixed this bug in the version 1.6.3 and updated the Conditional Logic extension. I'm waiting for a fix for the Builder, then AIO will be updated.
Thank you!!