Fix restore defaults for radio buttons
Fix restore defaults for radio buttons
This commit is contained in:
parent
10a0ddb123
commit
8268bbf81a
|
@ -1197,17 +1197,22 @@ $(".sccp-restore").click(function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
console.log('restore/checked');
|
|
||||||
edit_style.display = 'block';
|
edit_style.display = 'block';
|
||||||
|
var defaultVal = $(this).data("default");
|
||||||
if ($(this).data("type") === 'radio') {
|
if ($(this).data("type") === 'radio') {
|
||||||
// simulate read only for checkboxes
|
// simulate read only for checkboxes
|
||||||
input.forEach(
|
console.log(input);
|
||||||
function(radioElement) {
|
input.forEach(
|
||||||
radioElement.setAttribute('disabled', true);
|
function(radioElement) {
|
||||||
if (radioElement.hasAttribute('checked')) {
|
radioElement.setAttribute('disabled', true);
|
||||||
radioElement.removeAttribute('disabled');
|
if (radioElement.value === defaultVal){
|
||||||
}
|
radioElement.removeAttribute('disabled');
|
||||||
}
|
radioElement.setAttribute('checked', true);
|
||||||
|
} else {
|
||||||
|
radioElement.setAttribute('disabled', true);
|
||||||
|
radioElement.removeAttribute('checked');
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,6 +398,7 @@ class formcreate
|
||||||
// reverting to chan-sccp default values
|
// reverting to chan-sccp default values
|
||||||
echo " data-for={$res_id}";
|
echo " data-for={$res_id}";
|
||||||
echo " data-type=radio";
|
echo " data-type=radio";
|
||||||
|
echo " data-default={$sccp_defaults[$res_n]['systemdefault']}";
|
||||||
echo " class=sccp-restore";
|
echo " class=sccp-restore";
|
||||||
echo " id=usedefault_{$res_id}";
|
echo " id=usedefault_{$res_id}";
|
||||||
echo " ";
|
echo " ";
|
||||||
|
|
Loading…
Reference in a new issue