Skip to content

Commit 1bd6375

Browse files
committed
Alert when not all parameters are entered
1 parent 34c800e commit 1bd6375

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

www/app/UtilityController.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,28 +1101,29 @@ define(['app', 'livesocket'], function (app) {
11011101
var bValid = true;
11021102
bValid = bValid && checkLength($("#dialog-editcustomsensordevice #devicename"), 2, 100);
11031103
bValid = bValid && checkLength($("#dialog-editcustomsensordevice #sensoraxis"), 1, 100);
1104-
if (bValid) {
1105-
$(this).dialog("close");
1106-
var soptions = $.sensorType + ";" + encodeURIComponent($("#dialog-editcustomsensordevice #sensoraxis").val());
1107-
var cval = $('#dialog-editcustomsensordevice #combosensoricon').data('ddslick').selectedIndex;
1108-
var CustomImage = $.ddData[cval].value;
1109-
1110-
$.ajax({
1111-
url: "json.htm?type=setused&idx=" + $.devIdx +
1112-
'&name=' + encodeURIComponent($("#dialog-editcustomsensordevice #devicename").val()) +
1113-
'&description=' + encodeURIComponent($("#dialog-editcustomsensordevice #devicedescription").val()) +
1114-
'&switchtype=0' +
1115-
'&customimage=' + CustomImage +
1116-
'&devoptions=' + encodeURIComponent(soptions) +
1117-
'&used=true',
1118-
async: false,
1119-
dataType: 'json',
1120-
success: function (data) {
1121-
ShowUtilities();
1122-
}
1123-
});
1124-
1104+
if (!bValid) {
1105+
bootbox.alert($.t('Please provide a Name and Axis label!'));
1106+
return;
11251107
}
1108+
$(this).dialog("close");
1109+
var soptions = $.sensorType + ";" + encodeURIComponent($("#dialog-editcustomsensordevice #sensoraxis").val());
1110+
var cval = $('#dialog-editcustomsensordevice #combosensoricon').data('ddslick').selectedIndex;
1111+
var CustomImage = $.ddData[cval].value;
1112+
1113+
$.ajax({
1114+
url: "json.htm?type=setused&idx=" + $.devIdx +
1115+
'&name=' + encodeURIComponent($("#dialog-editcustomsensordevice #devicename").val()) +
1116+
'&description=' + encodeURIComponent($("#dialog-editcustomsensordevice #devicedescription").val()) +
1117+
'&switchtype=0' +
1118+
'&customimage=' + CustomImage +
1119+
'&devoptions=' + encodeURIComponent(soptions) +
1120+
'&used=true',
1121+
async: false,
1122+
dataType: 'json',
1123+
success: function (data) {
1124+
ShowUtilities();
1125+
}
1126+
});
11261127
};
11271128
dialog_editcustomsensordevice_buttons[$.t("Remove Device")] = function () {
11281129
$(this).dialog("close");

0 commit comments

Comments
 (0)