Multi checkbox support
-
Hi,
I needed to support a list of category in one of my widget by using page builder. ( an input checkbox with a name ‘xxx-categories[]’).
That code is not recurent but it work fine for me.
I have modified the js file “js/panels.admin.panels.js” as below :
Page builder (https://www.ads-software.com/plugins/siteorigin-panels/) version : 1.3.9Index: wp-content/plugins/siteorigin-panels/js/panels.admin.panels.js =================================================================== --- wp-content/plugins/siteorigin-panels/js/panels.admin.panels.js (source) +++ wp-content/plugins/siteorigin-panels/js/panels.admin.panels.js (workingcopy) @@ -198,14 +198,25 @@ // Populate the form values for ( c in data ) { if ( c != 'info' ) { - var de = dialog.find( '*[name$="[' + c + ']"]' ); - - if ( de.attr( 'type' ) == 'checkbox' ) { - de.prop( 'checked', Boolean( data[c] ) ); + if ( typeof data[c]=="object") { + for ( df in data[c]) { + var de = dialog.find( '*[name$="[' + c + ']['+ df +']"]' ); + if ( de.attr( 'type' ) == 'checkbox' ) { + de.prop( 'checked', Boolean( data[c] ) ); + } + else { + de.val( data[c] ); + } + } + } else { + var de = dialog.find( '*[name$="[' + c + ']"]' ); + if ( de.attr( 'type' ) == 'checkbox' ) { + de.prop( 'checked', Boolean( data[c] ) ); + } + else { + de.val( data[c] ); + } } - else { - de.val( data[c] ); - } } } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multi checkbox support’ is closed to new replies.