-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double input on form submission #500
Comments
Hi @stav3ng3r! The problem is that there is a hidden copy of the input/textarea contained inside the keyboard to determine scroll position. It isn't disabled, yet... I'll make a patch for that. You can solve the issue with your current version by either moving the keyboard outside of the form (don't modify the visible: function(e, keyboard) {
keyboard.$previewCopy[0].disabled = true;
} |
Additionally, for other users that might encounter this problem, if the $('#submit-button').submit(function(e) {
// prevent automatic form submission
e.preventDefault();
// disable alwaysOpen preview inputs
$('.ui-keyboard-preview').prop('disabled', true);
// re-enable the preview after submission
$('form').one('ajax:complete', function() {
$('.ui-keyboard-preview').prop('disabled', false);
});
// now submit the form
this.submit();
}); |
Thanks @Mottie I am already testing a dirty $('#loginForm').submit(function (e) {
$('.ui-keyboard-preview-clone').prop('disabled', true);
}); And is working fine so far. Where would I put that piece of hack ? var keyboardInput = $('#keyboardInput');
var keyboard = keyboardInput.keyboard({
language: 'es',
restrictInput: true, // Prevent keys not in the displayed keyboard from being typed in
preventPaste: true, // prevent ctrl-v and right click
autoAccept: true,
lockInput: true, // prevent manual keyboard entry,
// if true, the keyboard will always be visible
alwaysOpen: true,
stayOpen: true,
maxLength: 6,
usePreview: false,
// add keyboard to desired div
appendTo: '#keyboard',
// disable position utility
position: false,
layout: 'custom',
customLayout: {
'normal': [
'1 2 3',
'4 5 6',
'7 8 9',
'0',
'{clear}'
]
},
display: {
'clear': 'Limpiar'
},
visible: function(e, keyboard) {
keyboard.$previewCopy[0].disabled = true;
}
}).addScramble({
targetKeys: /[\d]/i // keys to randomize
}); |
Hmm, I see the |
Alright, that does it. Thanks again @Mottie |
I'm trying to make a simple numeric keypad:
Here is what I'm using:
It works fine, but when I hit submit on the form I got two input 'password' with one of them being one number less.
So if I hit 123456 on the keyborad, its displayed on the input. But on submit I receive 12345. When looking to the request raw I see two passwords inputs with one of them having 12345 and the other 123456.
The second input is created when I first hit a key on the keypad.
The text was updated successfully, but these errors were encountered: