rabin 1 year ago
parent
commit
fefb55fbad
1 changed files with 8 additions and 11 deletions
  1. 8 11
      assets/lib/manage/main.js

+ 8 - 11
assets/lib/manage/main.js

@@ -1706,17 +1706,19 @@ function checkbox()
 							}
 
 							var num = 0;
+							var id = $(this).attr('name');
+							var hidden = id;
+							id = id.replace('[]', '');
 							$(ele).each(function()
 							{
 								if($(this).get(0).checked == true)
 								{
 									num = 1;
+									if ($('#' + id).length) {
+										$('#' + id).remove();
+									}
 								}
 							});
-							
-							var id = $(this).attr('name');
-							var hidden = id;
-							id = id.replace('[]', '');
 							if(num == 0)
 							{
 								self.get(0).checked = false;
@@ -1729,13 +1731,8 @@ function checkbox()
 								if (state == 2) {
 
 								} else if (!$('#' + id).length) {
-									//self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+id+'" />');
+									self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+id+'" />');
 								}
-							} else {
-								/*
-								if ($('#' + id).length) {
-									$('#' + id).remove();
-								}*/
 							}
 
 							form.render('checkbox');
@@ -1894,7 +1891,7 @@ function checkbox()
 							if (state == 2) {
 
 							} else if (!$('#' + id).length) {
-								//self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
+								self.parent().append('<input type="hidden" value="0" id="'+id+'" name="'+hidden+'" />');
 							}
 						} else {
 							/*