Skip to content

Commit

Permalink
#92, use custom serialization of checkbox state for server saving
Browse files Browse the repository at this point in the history
  • Loading branch information
thrize committed Apr 14, 2018
1 parent a2c96d5 commit 42b7400
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion html/edit-config-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h2 class="sub-header">Configuration</h2>
<input type="checkbox" name="input_field_19" id="input_field_19">
</form>
</td>
<th><p><a class="btn btn-default" href="javascript:updateVar(19)" role="button">Update</a></p></th>
<th><p><a class="btn btn-default" href="javascript:updateVarChecked(19)" role="button">Update</a></p></th>
</tr>
</tbody>
</table>
Expand Down
9 changes: 9 additions & 0 deletions public/js/edit-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 42b7400

Please sign in to comment.