This is my code and I'm applying it to a Asp.Net 4 Textbox but when I hit Accept it doesn't close the keyboard. I've tried calling the accepted with the keyboard.accepted() callback but it starts an endless loop. I was able to close it with keyboard.destroy() but that defeats the purpose. I've also tried with autoAccept on and off.
$('.numpad').keyboard({
keyBinding: 'mousedown touchstart',
layout: 'custom',
autoAccept: true,
restrictInput: true,
acceptValid: false,
validate: function (keyboard, value, isClosing) {
// test value to only allow numbers RegEx between / RegEx /.test
var test = /^\d*(.\d{1,2})?$/.test(value);
// if the value is invalid, clear the input
if (!test) { keyboard.$preview.val(''); }
// return valid test (true or false)
return test;
},
customLayout: {
'default': ['7 8 9', '4 5 6', '1 2 3', '0 00', '{a} {b} .']
},
usePreview: false // no preveiw
});
This is my code and I'm applying it to a Asp.Net 4 Textbox but when I hit Accept it doesn't close the keyboard. I've tried calling the accepted with the keyboard.accepted() callback but it starts an endless loop. I was able to close it with keyboard.destroy() but that defeats the purpose. I've also tried with autoAccept on and off.
$('.numpad').keyboard({
keyBinding: 'mousedown touchstart',
layout: 'custom',
autoAccept: true,
restrictInput: true,
acceptValid: false,
validate: function (keyboard, value, isClosing) {
// test value to only allow numbers RegEx between / RegEx /.test
var test = /^\d*(.\d{1,2})?$/.test(value);
// if the value is invalid, clear the input
if (!test) { keyboard.$preview.val(''); }
// return valid test (true or false)
return test;
},
customLayout: {
'default': ['7 8 9', '4 5 6', '1 2 3', '0 00', '{a} {b} .']
},
usePreview: false // no preveiw
});