Step1: Declare global variable to get all the checkboxes
var i;
checkboxes = document.querySelectorAll(‘input[type=checkbox]’);
Step2: Use the following function to save the checked checkboxes values into localstorage
function save() {
for (i = 0; i < checkboxes.length; i++) {
localStorage.setItem(checkboxes[i].value,checkboxes[i].checked);
}
}
Step3: Use the following function to get the checked checkboxes values from localstorage
function load() {
for (i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = localStorage.getItem(checkboxes[i].value) === ‘true’ ? true:false;
}
}
Step3: Call the function save()
Step4:Inside the function perform update process using javascript:apex.submit
Step5: Use Dynamic operation to load the checked checkbox values by calling the function load()
Step6: while selecting the checkboxes and submitting the update button, function save() will be called, and the update process will be performed.
Step7: Once the page gets refresh, the function load() will retain the checked checkboxes values.
Summary: This Post explains how to Retain checkbox value after refresh the page
Queries?
Do drop a note by writing us at contact@doyensys.com or use the comment section below to ask your questions.