Skip to content
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

keyboard.accept(); not working when usePreview: false in change function #311

Closed
austb25 opened this issue Oct 1, 2014 · 12 comments
Closed

Comments

@austb25
Copy link

austb25 commented Oct 1, 2014

Hi!

When I set usePreview : true, (and reference keyboard.$preview.val() in my change function), my code works, but as soon as I change usePreview: false it breaks and when the user enters 4 characters the keyboard does not close & accept the input. Here is my code:

$('#yearInput').keyboard({
    layout: 'custom',
    customLayout: {
        'default': [
            '1 2 3',
            '4 5 6',
            '7 8 9',
            '0 {bksp}'
        ]
    },
    restrictInput: true, 
    preventPaste: true,
    autoAccept: true,
    maxLength: 4,
    usePreview: false,
    appendTo: '#date-filter',
    change: function(e, keyboard, el) {
        if (keyboard.$el.val().length >= 4) {
            keyboard.accept();  // I've also tried keyboard.accept(true);
            $('#submitButton').show();
        }
    }
});

Thanks!

@austb25
Copy link
Author

austb25 commented Oct 1, 2014

Related to: #308

@Mottie
Copy link
Owner

Mottie commented Oct 1, 2014

Hi @austb25!

Hmm, keyboard.$preview is set to be the same as keyboard.$el when usePreview is false, so it shouldn't behave differently. I'll try to look into this today.

@Mottie
Copy link
Owner

Mottie commented Oct 1, 2014

Please try this demo, it is pointing to the keyboard script in the working branch.

Once I get some of these other issues taken care of, I'll update the master branch with an updated version number.

@austb25
Copy link
Author

austb25 commented Oct 2, 2014

Thanks @Mottie! It worked!

@austb25
Copy link
Author

austb25 commented Oct 6, 2014

@Mottie for some reason I am now getting an error in firefox with the new keyboard.js script. This is the error I get:
screen shot 2014-10-06 at 10 30 42 am

When I switch back to the old keyboard.js firefox does not show any errors but the original problem is still present.

@Mottie
Copy link
Owner

Mottie commented Oct 6, 2014

Hi @austb25!

What kind of input type are you using?

@austb25
Copy link
Author

austb25 commented Oct 6, 2014

just a text input. I didn't want to use the number input because of the spinner icons

@Mottie
Copy link
Owner

Mottie commented Oct 6, 2014

I can't seem to reproduce this error. Would you please modify this demo to show the error; it is pointing to the working branch copy of the plugin. Thanks.

@austb25
Copy link
Author

austb25 commented Oct 6, 2014

Hi @Mottie! Unfortunately, as soon as it loads the error appears in firefox (in firebug). I am on Firefox version 32.0.3 on Mac OS X version 10.9.5 if that helps!

@austb25
Copy link
Author

austb25 commented Oct 6, 2014

I have also replicated the issue on a PC :(

Mottie added a commit that referenced this issue Oct 6, 2014
…311

Seehttps://bugzilla.mozilla.org/show_bug.cgi?id=1078702
@Mottie
Copy link
Owner

Mottie commented Oct 6, 2014

Ok, I found the problem, and hopefully fixed it in the working branch.

I totally messed up trying that demo in Firefox... probably that bad headache I had earlier.

@Mottie
Copy link
Owner

Mottie commented Nov 20, 2014

Ok, this should be fixed in 1.19.0. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants