Fix checkbox options missing selections with conditional settings

This commit is contained in:
Champ Camba
2020-01-04 13:03:03 +08:00
parent f480a966d4
commit 17108a441d
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -35,9 +35,12 @@ function um_get_field_default_value( $dom ) {
if ($dom.find('input[type=checkbox]:checked').length >= 1) {
if ($dom.find('input[type=checkbox]:checked').length > 1) {
var arr_values = [];
arr_values.push( default_value );
$dom.find('input[type=checkbox]:checked').each(function () {
default_value = default_value + jQuery(this).val() + ' ';
arr_values.push( jQuery(this).val() );
});
default_value = arr_values;
} else {
default_value = $dom.find('input[type=checkbox]:checked').val();
}
@@ -387,6 +390,7 @@ function um_field_restore_default_value( $dom ) {
case 'checkbox':
if ( $dom.find('input[type=checkbox]:checked').length >= 1 ) {
$dom.find('input[type=checkbox]:checked').removeAttr('checked');
@@ -408,7 +412,7 @@ function um_field_restore_default_value( $dom ) {
cbox_elem.closest('.um-field-checkbox').find('i').removeClass('um-icon-android-checkbox-outline-blank');
cbox_elem.closest('.um-field-checkbox').find('i').addClass('um-icon-android-checkbox-outline');
cbox_elem.closest('.um-field-checkbox').addClass('active');
}
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long