From 42b7400addfb13666935142b9278924f248124a5 Mon Sep 17 00:00:00 2001 From: thrize Date: Sat, 14 Apr 2018 12:52:11 +0100 Subject: [PATCH] #92, use custom serialization of checkbox state for server saving --- html/edit-config-2.html | 2 +- public/js/edit-config.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/html/edit-config-2.html b/html/edit-config-2.html index 4f85bc4..c5c3362 100644 --- a/html/edit-config-2.html +++ b/html/edit-config-2.html @@ -212,7 +212,7 @@

Configuration

-

Update

+

Update

diff --git a/public/js/edit-config.js b/public/js/edit-config.js index d241ca1..2fed854 100644 --- a/public/js/edit-config.js +++ b/public/js/edit-config.js @@ -31,6 +31,15 @@ function updateVar(index) { } } +function updateVarChecked(index) { + var name = fieldNames[index]; + var elementId = "input_field_" + index; + var element = document.getElementById(elementId); + if (element) { + window.location.href = "/edit-config?"+name+"="+btoa(element.checked ? 'on' : 'off'); + } +} + function setupConfigVars() { $.getJSON( "/get-config-vars?session_key="+getCookie("session_key"), function(data) { if (data && data.error) {