Is there any option for primefaces keyboard component to accept numbers form both keyboard and mouse?
I'm using primefaces keyboard component with keypadonly option to enter numbers only.
I should be able to enter numbers either from physical keyboard or virtual keyboard.
If keypadonly is set to true, I'm not able to enter data using physical keyboard.
I don't have this problem if keypadonly only attribute is not used. Did someone experience this problem? If so please let me know how to handle it.
It seems to be intentional, if keypadonly is set to true a javascript will set the input to readonly="readonly".
You may try to use a custom layout (see http://www.primefaces.org/showcase/ui/keyboard.jsf ).
This migth work:
<p:keyboard value="#{keyboardBean.value}"
layout="custom"
layoutTemplate="123-close,456-clear,789-back,0"/>
or removing the readonly attribute with a custom javascript.
Related
I am using XCTest to test my IOS app.
As part of a test case I need to enter a number into a field (which is not a text box)
When I record the test, following code is generated when I use the soft keyboard on the simulator(IPAD/IPhone)
app.staticTexts["0"].tap() //Line 1
app.typeText("23") //Line 2
When I execute the test, the soft keyboard pops up after Line 1. But when Line 2 is executed, following error appears
UI Testing Failure - Neither element nor any descendant has keyboard focus
My app requires to be installed on IPads/IPhones. So I need to make it run through the soft keyboard route only.
So I think typeText is not the correct method. What is the method to simulate clicks on a soft/virtual keyboard in an IOS simulator?
You need to call typeText() on the element with keyboard focus, not just app.
If the element was a text field, you would find the text field element and call typeText() on that.
let element = app.textFields["myTextField"]
element.typeText("23")
You will need to replace the query with your own one for finding the element which has keyboard focus. Usually, this would be a descendant of UITextField but you will need to use a more custom query if you are using a custom view instead.
I want to keep the keyboard displayed at the bottom by default without using a text input which the user needs to tap.
I need to keep the keyboard at the bottom at all times.
Then I need to listen to the events of the keyboard.
How can I do this?
The workaround I implemented was adding an invisible text box somewhere on the screen and then set it as focused manually.
Just in case someone else might stumble upon this, OP's self answer works. In order to set focus manually, you'll need to get the ref to the hidden input.
<TextInput
ref={input => (this.textinput = input)}
style={{ display: 'none' }}
/>
then elsewhere in the code, you focus manually by
if (this.textinput) {
this.textinput.focus();
}
This answer is way too late to do the OP any good, but for others:
You can't do this. In iOS, the operating system, keyboards simply don't/can't work this way. iOS never shows a keyboard without an active text input focus, and there is no way for even a native iOS app to override this OS-level behavior. The OS itself prevents this from happening.
Just noticed that in UITextView keyboard comes without change language button, unlike in UITextField. Why Apple removed this button from UITextView keyboard? Is there any way to enable this button? I want people to be able to write notes on any keyboard language added in phone settings.
EDITED: Maybe it will help somebody in the future. Just noticed that I set keyboard type to UIKeyboardTypeAlphabet and this option eliminates language button. Closing this question.
P.S. I have 3 languages enabled in test iPhone.
You are completely wrong. there is no difference in UIKeyboard in iOS whatsoever. It only depends on what keyboard types you use.
UIKeyboardTypeDefault and UIKeyboardTypeEmailAddress and UIKeyboardTypeTwitter all have those.
You set it like this:
txtField.keyboardType = UIKeyboardTypeTwitter;
UIKeyboardTypeDefault is obviously the default one for any UITextView or UITextField in iOS.
For anyone have this problem even when using UIKeyboardTypeDefault on a UITextView, go into the storyboard and make sure "Secure Text Entry" is unchecked. After unchecking this, the keyboard selector will return as well as the quick type keyboard.
How does one prevent “…misspelled” from being spoken by VoiceOver on a text field? Setting autocorrectionType to UITextAutocorrectionTypeNo doesn’t seem to make a difference.
If the iOS user types a misspelled word followed by a space or punctuation, Voiceover speaks the word followed by, “misspelled.” I want to be able to disable this behavior on a specific text field.
I would expect you to set spellCheckingType = UITextSpellCheckingTypeNo to get this behavior rather than autocorrectionType. Does that not resolve it?
I have a requirement wherein I have to change the text of the return key of the iPad to Sign-in. Obviously it is not one of the options available in the sdk. I have searched it over the net and it seems doing that possible.
The only question remaining is whether the app would be accepted by Apple if I modify the default system keyboard? The HIG is not clear on this , it states that "A custom input view can replace the system-provided onscreen keyboard in apps" and "You can also provide a custom input accessory view, which is a separate view that appears above the keyboard (or your custom input view)". Nothing about whether we are allowed to add an extra button on a system keyboard.
Any experiences??
#Vin you can change the name of return key of the keyboard to your requirement. I have an app that has the changed to return key name to Done and Search. And apple did not reject it.
To "Sign-In" you can use the return key UIReturnKeyJoin
textField.returnKeyType = UIReturnKeyJoin;
EDIT
Nope. You get the return key and
keyboard types defined in the OS.
Unless you want to try to hack the
keyboard's view hierarchy to change
that button, which would be a really
bad plan. (Standard recommendation
here is to file a bug report with
Apple to let them know you'd like
more/different options.)
see Custom iPhone return key text
Since I didn't get any satisfactory answer, I convinced the client that it would be inappropriate to modify the default system keyboard for a sake of one button(even if it is allowed by Apple). We are now going for the "Go" option available for return key.