q_all/wp_all checking problem fixed

This commit is contained in:
Hash Borgir 2023-06-12 02:34:34 -06:00
parent e9fdeede11
commit 9d95eedd76

View File

@ -432,22 +432,24 @@ $(document).ready(function () {
}); });
function updateAllCheckbox(parentFormId, checkboxClass, allCheckboxClass) {
var allChecked = $(`#${parentFormId} ${checkboxClass}:checked`).length === $(`#${parentFormId} ${checkboxClass}`).length;
var checkedValue = allChecked ? 'checked' : '';
var val = allChecked ? 1 : 0;
$(`#${parentFormId} ${allCheckboxClass}`).prop('checked', checkedValue).val(val);
}
$('.wpcheck').change(function () { $('.wpcheck').change(function () {
var parentFormId = $(this).closest("form").attr("id"); var parentFormId = $(this).closest("form").attr("id");
var wpallChecked = $(`#${parentFormId} .wpcheck:checked`).length === $(`#${parentFormId} .wpcheck`).length; updateAllCheckbox(parentFormId, '.wpcheck', '.wp_all');
var wpchecked = wpallChecked ? 'checked' : '';
var val = wpallChecked ? 1 : 0;
$(`#${parentFormId} .wp_all`).prop('checked', wpchecked).val(val);
}); });
$('.qcheck').change(function () { $('.qcheck').change(function () {
var parentFormId = $(this).closest("form").attr("id"); var parentFormId = $(this).closest("form").attr("id");
var qallChecked = $(`#${parentFormId} .qcheck:checked`).length === $(`#${parentFormId} .qcheck`).length; updateAllCheckbox(parentFormId, '.qcheck', '.q_all');
var qchecked = qallChecked ? 'checked' : '';
var val = qallChecked ? 1 : 0;
$(`#${parentFormId} .q_all`).prop('checked', qchecked).val(val);
}); });
$('.setallskills').change(function () { $('.setallskills').change(function () {
var value = $(this).val(); var value = $(this).val();
var parentFormId = $(this).closest("form").attr("id"); var parentFormId = $(this).closest("form").attr("id");