Ignore settings form fields with empty name attr on save

This commit is contained in:
peteruithoven 2013-12-23 17:39:37 +01:00
parent d50a42ef09
commit 1f1b6c89dd
2 changed files with 13 additions and 10 deletions

View File

@ -321,7 +321,8 @@ function SettingsWindow() {
var selects = self.form.find("select"); var selects = self.form.find("select");
selects.each( function(index,element) { selects.each( function(index,element) {
var element = $(element); var element = $(element);
if(element.attr('name') != "network.client.network") { var fieldName = element.attr('name');
if(element.attr('name') != "") {
settings[element.attr('name')] = element.val(); settings[element.attr('name')] = element.val();
} }
}); });
@ -329,14 +330,16 @@ function SettingsWindow() {
var inputs = self.form.find("input"); var inputs = self.form.find("input");
inputs.each( function(index,element) { inputs.each( function(index,element) {
var element = $(element); var element = $(element);
switch(element.attr("type")) { if(element.attr('name') != "") {
case "text": switch(element.attr("type")) {
case "number": case "text":
settings[element.attr('name')] = element.val(); case "number":
break; settings[element.attr('name')] = element.val();
case "checkbox": break;
settings[element.attr('name')] = element.prop('checked') case "checkbox":
break; settings[element.attr('name')] = element.prop('checked')
break;
}
} }
}); });

View File

@ -150,7 +150,7 @@
The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small> The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
<br> <br>
<label for="network">Network:</label> <label for="network">Network:</label>
<select id="network" name="network.client.network"></select> <select id="network" name=""></select>
<input type="button" name="refresh" value="Refresh" class="button" id="refreshNetworks"/><br> <input type="button" name="refresh" value="Refresh" class="button" id="refreshNetworks"/><br>
<label for="password" id="passwordLabel">Password:</label><input type="password" name="network.client.password" id="password"><br> <label for="password" id="passwordLabel">Password:</label><input type="password" name="network.client.password" id="password"><br>
<input type="button" name="connect" value="Connect" class="button" id="connectToNetwork"/> <input type="button" name="connect" value="Connect" class="button" id="connectToNetwork"/>