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