Skip to content

Commit 6cccb7e

Browse files
committed
attempt input onblur handling
1 parent f91dc2a commit 6cccb7e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/glow/primitives.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,16 +2914,26 @@
29142914
attrs.jwinput = $('<input type="text" id="'+attrs._id+'"/>').val(attrs.text).appendTo(attrs.pos)
29152915
.css({"width":attrs.width.toString()+'px', "height":attrs.height.toString()+'px',
29162916
"font-size":(attrs.height-5).toString()+"px", "font-family":"sans-serif"})
2917-
.keypress( function(k) { if (k.keyCode == 13) { // 13 is Next
2917+
.keypress( function(k) {
2918+
if (k.keyCode == 13) { // 13 is Next
2919+
attrs.text = attrs.jwinput.val()
2920+
var ok = wparse()
2921+
if (!ok) {
2922+
alert('Numeric input error')
2923+
return
2924+
}
2925+
attrs.bind(cwinput)
2926+
}
2927+
})
2928+
.blur(function(k) {
29182929
attrs.text = attrs.jwinput.val()
29192930
var ok = wparse()
29202931
if (!ok) {
29212932
alert('Numeric input error')
29222933
return
29232934
}
29242935
attrs.bind(cwinput)
2925-
}
2926-
})
2936+
})
29272937

29282938
var cwinput = { // this structure implements a JavaScript "closure", essential for winput to work
29292939
get disabled() {return attrs.disabled},

0 commit comments

Comments
 (0)