@@ -1101,28 +1101,29 @@ define(['app', 'livesocket'], function (app) {
1101
1101
var bValid = true ;
1102
1102
bValid = bValid && checkLength ( $ ( "#dialog-editcustomsensordevice #devicename" ) , 2 , 100 ) ;
1103
1103
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 ;
1125
1107
}
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
+ } ) ;
1126
1127
} ;
1127
1128
dialog_editcustomsensordevice_buttons [ $ . t ( "Remove Device" ) ] = function ( ) {
1128
1129
$ ( this ) . dialog ( "close" ) ;
0 commit comments