Skip to content

Commit

Permalink
Do not set repeated field values to string "false" when boolean false.
Browse files Browse the repository at this point in the history
…Fixes CMB2#1138
  • Loading branch information
jtsternberg committed May 25, 2018
1 parent 22c7fbd commit 32e7761
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/cmb2.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ window.CMB2 = window.CMB2 || {};
var oldVal = $newInput.val();
var type = $newInput.prop( 'type' );
var defVal = cmb.getFieldArg( $newInput, 'default' );
var newVal = 'undefined' !== typeof defVal ? defVal : '';
var newVal = 'undefined' !== typeof defVal && false !== defVal ? defVal : '';
var tagName = $newInput.prop('tagName');
var checkable = 'radio' === type || 'checkbox' === type ? oldVal : false;
var attrs = {};
Expand Down Expand Up @@ -611,7 +611,7 @@ window.CMB2 = window.CMB2 || {};
$( cmb.noEmpty, row ).each( function() {
var $el = $(this);
var defVal = cmb.getFieldArg( $el, 'default' );
if ( false !== defVal ) {
if ( 'undefined' !== typeof defVal && false !== defVal ) {
$el.val( defVal );
}
});
Expand Down
Loading

0 comments on commit 32e7761

Please sign in to comment.