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

Click on Accept button and going to next input #528

Closed
grouser opened this issue Feb 24, 2017 · 10 comments
Closed

Click on Accept button and going to next input #528

grouser opened this issue Feb 24, 2017 · 10 comments

Comments

@grouser
Copy link

grouser commented Feb 24, 2017

Hello,

I am using the keyboard in a touch screen. I would like to click on the "Accept" button and move the focus to the next field. Would that be possible? I only see the setting when pressing the "Enter" key.

Thanks.

@ghost
Copy link

ghost commented Feb 25, 2017

Hi, check out this: https://jsfiddle.net/Mottie/k22Lybw3/

By pressing on prev and next you move the focus to the previous and next input field. With some modifying, you can add the 'next' function to 'accept'.

@Mottie
Copy link
Owner

Mottie commented Feb 25, 2017 via email

@afattahi54
Copy link

Of Topic :)

I have used lots of projects in github, but rarely found the support which Mottie gives to us compare to other projects.
Thanks dear @Mottie and I wish you the best !

@grouser
Copy link
Author

grouser commented Feb 28, 2017

Thank you very much @exyoris

@grouser
Copy link
Author

grouser commented Feb 28, 2017

I have changed $("input") to $(":input:not([type=hidden])") so that it doesn't get the hidden fields if you are using the auto-complete plugin.

@Mottie
Copy link
Owner

Mottie commented Mar 1, 2017

I'll take a closer look at this when I get back next week

@Mottie
Copy link
Owner

Mottie commented Mar 9, 2017

Issue #524 has an example of multiple inputs allowing you to switch to the previous and next inputs using internal keys. The last input changes the "next" button to "submit".

In this demo, a modified version of the above demo, the "accept" key action is modified to automatically switch to the next input

$(function() {
  $.keyboard.keyaction.accept = function(kb) {
    kb.switchInput(true, kb.options.autoAccept);
    return false; // prevents further processing
  };
  $('#wrap input').keyboard({
    usePreview: false,
    autoAccept: true
  });
});

@Mottie
Copy link
Owner

Mottie commented Mar 16, 2017

In the latest release, you no longer required to include return false inside the keyaction to stop further processing & prevent js errors.

@grouser
Copy link
Author

grouser commented Mar 16, 2017

Wow. It works like a charm. Thanks Mottie!

@Mottie
Copy link
Owner

Mottie commented Apr 5, 2017

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Apr 5, 2017
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

3 participants