mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 01:07:56 +01:00
Properly reading all the values from the form when saving
This commit is contained in:
parent
2deec18072
commit
4d53a2ee19
@ -102,16 +102,6 @@ function SettingsWindow() {
|
||||
this.saveSettings = function(callback) {
|
||||
console.log("Settings:saveSettings");
|
||||
|
||||
//var printerSettings = {};
|
||||
$("#printersettings input").each( function(index,element) {
|
||||
var element = $(element);
|
||||
//populate settings are with values from html
|
||||
if(element.attr("type") == "text" || element.attr("type") == "number") {
|
||||
settings[element.attr('name')] = element.val();
|
||||
} else if(element.attr("type") == "checkbox") {
|
||||
settings[element.attr('name')] = element.prop('checked')
|
||||
}
|
||||
});
|
||||
this.readForm();
|
||||
|
||||
if (communicateWithWifibox) {
|
||||
@ -171,7 +161,6 @@ function SettingsWindow() {
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: textarea's
|
||||
var textareas = this.form.find("textarea");
|
||||
console.log(textareas);
|
||||
textareas.each( function(index,element) {
|
||||
@ -186,15 +175,29 @@ function SettingsWindow() {
|
||||
|
||||
this.readForm = function() {
|
||||
console.log("SettingsWindow:readForm");
|
||||
// read settings from form
|
||||
var selects = this.form.find("select");
|
||||
selects.each( function(index,element) {
|
||||
var element = $(element);
|
||||
settings[element.attr('name')] = element.val();
|
||||
});
|
||||
|
||||
var inputs = this.form.find("input");
|
||||
inputs.each( function(index,element) {
|
||||
var element = $(element);
|
||||
switch(element.attr("type")) {
|
||||
case "text":
|
||||
case "number":
|
||||
settings[element.attr('name')] = element.val();
|
||||
break;
|
||||
case "checkbox":
|
||||
settings[element.attr('name')] = element.prop('checked')
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: textarea's
|
||||
var textareas = this.form.find("textarea");
|
||||
console.log(textareas);
|
||||
textareas.each( function(index,element) {
|
||||
var element = $(element);
|
||||
console.log("printer textarea: ",index,element.attr('name')); //,element);
|
||||
console.log(" val: ",element.val());
|
||||
settings[element.attr('name')] = element.val();
|
||||
});
|
||||
console.log(settings);
|
||||
|
Loading…
Reference in New Issue
Block a user