Closed undefined-user-ctrl closed 6 years ago
Hi @lucas-signorini!
Thanks, I'm glad you're finding the plugin useful!
Hmm, I guess there isn't anyway to add a space to restrictInclude
option. The alternative is to add it to the built layout when the keyboard becomes visible (demo):
$(function() {
$("#keyboard").keyboard({
layout: "num",
restrictInput: true,
restrictInclude: "( ) -",
visible: function() {
var layout = $.keyboard.builtLayouts["num"].acceptedKeys;
if (layout.indexOf(" ") < 0) {
layout.push(" ");
}
}
});
});
I'll see what I can do to make this process a bit easier.
Hi @Mottie,
In my case i'm using a 'custom3' layout, just changed that in $.keyboard.builtLayouts["num"].acceptedKeys; and it worked like a charm :)
Thanks for quick reply!
In v1.27.1, you can now add a space as follows (demo):
$(function() {
$("#keyboard").keyboard({
layout: "num",
restrictInput: true,
restrictInclude: "( ) - {space}"
});
});
And updated docs.
Hi,
I am using this options to restrict input, and its working fine.
restrictInput : true, restrictInclude : '( ) -',
But, for some reason, i need to be able to add an space via validation (called in beforeInsert method), and i cannot figure how to add it in 'restrictInclude' option.
How should i do that? I tried '( ) - ' (two spaces), and '( ) - {space}', but no lucky.
Btw nice plugin :)