Skip to content

Commit

Permalink
gs
Browse files Browse the repository at this point in the history
  • Loading branch information
veryspry committed Feb 20, 2023
1 parent 2d57b6c commit 076e32b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions gp-advanced-save-and-continue/gpasc-radio-button-toggle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var formId = 5;
var gpascInstanceKey = 'GPASC_' + formId;
var enabledSelector = '#choice_' + formId + '_1_0';
var disabledSelector = '#choice_' + formId + '_1_1'

function enableGPASC() {
if (window[gpascInstanceKey] && window[gpascInstanceKey].enable) {
window[gpascInstanceKey].enable();
}
}

function disableGPASC() {
if (window[gpascInstanceKey] && window[gpascInstanceKey].enable) {
window[gpascInstanceKey].disable();
}
}

if ($(enabledSelector)[0].checked ) {
enableGPASC()
} else if ($(disabledSelector)[0].checked) {
disableGPASC();
}

$(enabledSelector).on('change', function(event) {
if (event.target.checked) {
enableGPASC();
}
})

$(disabledSelector).on('change', function(event) {
if (event.target.checked) {
disableGPASC();
}
})

0 comments on commit 076e32b

Please sign in to comment.