@@ -85,7 +85,7 @@ function demo() {
8585 for ( t in model . input . tensorOrders ) {
8686 if ( model . input . tensorOrders [ t ] < 0 ) {
8787 model . input . tensorOrders = { } ;
88- model . input . error . message = "Tensor " + t + " has inconsistent order" ;
88+ model . input . error . message = "Tensor <tt> " + t + "</tt> has inconsistent order" ;
8989 break ;
9090 }
9191 }
@@ -267,26 +267,33 @@ function demo() {
267267
268268 var txtExprView = {
269269 timerEvent : null ,
270+ errorMsg : "" ,
271+ lastInput : "" ,
270272
271273 updateView : function ( ) {
274+ var currInput = $ ( "#txtExpr" ) . val ( ) ;
272275 if ( model . output . error !== "" ) {
273276 clearTimeout ( txtExprView . timerEvent ) ;
274- txtExprView . timerEvent = null ;
275- $ ( "#lblError" ) . html ( model . output . error ) ;
277+ txtExprView . errorMsg = model . output . error ;
276278 $ ( "#txtExpr" ) . parent ( ) . addClass ( 'is-invalid' ) ;
277279 } else if ( model . input . error . message !== "" ) {
278- if ( ! txtExprView . timerEvent ) {
280+ if ( model . input . error . message !== txtExprView . errorMsg ||
281+ txtExprView . lastInput != currInput ) {
282+ clearTimeout ( txtExprView . timerEvent ) ;
283+ txtExprView . errorMsg = model . input . error . message ;
279284 var markError = function ( ) {
280- $ ( "#lblError" ) . html ( model . input . error . message ) ;
281285 $ ( "#txtExpr" ) . parent ( ) . addClass ( 'is-invalid' ) ;
286+ txtExprView . errorMsg = "" ;
282287 } ;
283288 txtExprView . timerEvent = setTimeout ( markError , model . input . error . delay ) ;
284289 }
285290 } else {
286291 clearTimeout ( txtExprView . timerEvent ) ;
287- txtExprView . timerEvent = null ;
292+ txtExprView . errorMsg = "" ;
288293 $ ( "#txtExpr" ) . parent ( ) . removeClass ( 'is-invalid' ) ;
289294 }
295+ $ ( "#lblError" ) . html ( txtExprView . errorMsg ) ;
296+ txtExprView . lastInput = currInput ;
290297 }
291298 } ;
292299
0 commit comments