h:inputText getting wrong value on chrome browser and android - android

I have form where several inputText fields are there which are binded to a backing bean. Strange behavior is happening with last textfield which is showing value present in some other text field (random). If I make last textfield as outputText, then that value shift to the previous textField and outputText has correct value then.
Another noticable behavior is when form is getting loaded, it shows correct value but when it is loaded completely, it changes that value to wrong one (randome). Also, on cancel it shows correct value momentarily.
I hope this explanation makes some sense. Anyone else with same kind of problem? Please let me know, if there is any solution for this. Let me know, if more info is needed.
This is happening specifically on Android and chrome browser.

I've experienced some strange autocomplete bugs in Chrome as well which get triggered by very specific form/input names/labels. The Android stock browser uses the same Webkit browser engine (and Apple Safari also), so that explains why they have the same problem. Try updating the browsers. Note that this is not specifically related to JSF.
From the server side on, your best bet is to try to turn off the autocomplete feature by setting the autocomplete attribute of the input elements to off.
<h:inputText ... autocomplete="off" />

Related

How to make text input with dropdown suggestions using Flutter

I have just begun using Flutter to create a mobile app.
The first thing I need the app to do is to take an Address/location as input from the user.
I would like to use a text input field that once you start typing it suggests locations based on the google place API.
Sadly there is no widget to enable this out of the box, but it shouldn't be so hard to do. Google's places API returns results based on any text input, so you can just keep sending keystrokes until the user sees (and selects) their desired location. I've got the API working already.
Now I'm struggling with how to build the front end experience.
I was hoping to have a drop-down text field, but I'm not finding anything similar in the widget library.
My next best idea was an input field with a DropdownButton class next to it. I want to make the DropdownButton invisible (0 width) but programmatically make it drop down once the user begins typing.
Sadly I don't see any way to control the visibility of the Dropdown List, so I'm not sure this will work.
Does anyone have any better ideas?
Image of what I have so far but obviously this is not optimal:
It's probably late for an answer but I'll still post this in case anyone else is still curious about this.
If you have the API wired up then what might prove useful is this third-party package.
It's called Flutter Typeahead.
It's a generic input with dropdowns and the data can come from any API and not just the Google Places API.

My Website input field on Android causing keyboard to appear and disappear instantly

I am building a small site and ran into a small problem. I am using MixItUp to filter and sort blocks. I am also using a search field to search through the titles of each block and display relevant ones. Everything works fine on all devices and browsers except for Android.
On Android when I tap into the search field my keyboard slides up and then slides away again without giving me a chance to type anything. I tried googling the problem and only relevant thing I could find was this post but I am not sure how to proceed because I have no clue what event listeners would be disrupting the android one.
I am not a very experienced developer (self-taught and still learning lots) so I am not sure how I would go about correcting. My plan right now is to just remove pieces of code until keyboard starts working and then go from there once I identify what is causing it.
The Website is teste3.khalidsleiman.com
I figured out it was a jQuery snippet that I was using to relocate the input field to a different spot on my page depending on window size. Now I only have it set to run that snippet on document load instead of window load and resize. Keyboard is showing up now.

Numeric keyboard as default, but allow text

I'm currently developing an application targeted at android and desktop devices using apache cordova and HTML5.
In order to get the numeric keyboard to pop up I've used input type="number", which works fine.
However, the input field should also accept strings. The current functionality of type=number is that the ui seems to allow for strings to be entered, but the value property of the element is not changed if the input is invalid (e.g not numberic).
Is there a way of getting the numberic keyboard on mobile devices, while still being able to enter text?
My inital tries consisted of capturing the keydown event and manually setting the this.value property. I've tried this using jQuerys .val() and of course the more 'native' approach element.val += char. None of which work. UI is updated, but the change is not reflected in the model.
EDIT
For the next guy trying to achieve this.
1) The HTML solution.
As #LuudJacobs mentions in the comments below; There's currently no way to decide which keyboard is shown except for defining the type-attribute. Though some devices have a button to go back to alphabet keyboard, its not the case for every device. And can not be used reliably.
2) Writing a phonegap/cordova plugin.
It is possible to write a plugin to show and hide the keyboard at will. But, as far as I could find, there is currently no way of programmatically telling it to default to the symbols keyboard. Thus the functionality achieved is similar to using type=number and type=text in the HTML. Another problem with this approach is the diversity of keyboard for android devices, where even users themselves can install their custom keyboard. The functionality of the keyboard can are therefore unknown. What works on one device, may not work on the next.
3) JS/HTML/Canvas solution
Finally... A feasible solution. I suggest taking a look at this walkthrough as it shows an easy way to creating the keyboard using just html and js. Another option would be to use a canvas, and draw the keyboard yourself, but I would imagine that this is more error prone and harder to do.
As explained in the HTML5 spec you can not have anything but valid floats in a input type="number". So You can not. On a sidenote: how would users enter text when they'd only have a numeric keyboard?

IME and catching (touch) events

Im currently trying to get my diploma in psychology and i want to write about different types of keyboards for smartphones. To research this area i need a tool that measures times. As Im new to Android programming, my friend is helping me, but we got stuck.
Here is what we need, and what we tried. Id really appreciate any help =)
We need a way to call a function before user input in IME begins and after user input in IME ends. (We need this only for timelogging, we dont need the actual input.)
We also need to call a function before user input for chosing autocorrection starts/ends.
We need to do this for all kinds of IMEs especially keyboards
like Swype, Swiftkey etc (though one of them working is enough)
We tried:
TextWatcher via addTextChangedListener
- seems to be unreliable to get the times beforeTextChanged/afterTextChanged is randomly called, even within a gesture
or multiple times within a gesture
subclassing EditText implementing OnTouchListener,
using onTouch()
- didnt seem to get called at all when using swype, so either we did it wrong or ime/swpye consumes those events,
also tried it with onKeyPreIme, wasnt called either
Ideal would be:
a way of catching the "touch" events before they are passed to the IME to log the current time via System.currentTimeMillis()
the same "after" the gesture ends i.e. when the finger is released from display
we dont need actual code, a link to the right command/documentation/widget would be sweet.
You get bonus cookies if you are ever in berlin and need a place to ... get cookies :)
Not sure if this is much of an answer, but...
Is your plan to write this in an Android application that you can distribute and run on anybody's device?
Sounds like whatever you do on the EditText or your application may not be enough because the IME is a separate module in Android, so you would not be able to get any information about auto correct or prediction or things like that (different IME have different of such features). You would only be able to get the text entered (or removed) from the text entry.
The best I can think of is for you to develop your own IME, then you can log anything you like in there.
To go about that, I would suggest, you first checkout this article from Android Developer:
http://developer.android.com/guide/topics/text/creating-input-method.html
And then you can check out the source code for the default Latin IME there:
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.1_r1/com/android/inputmethod/latin/LatinIME.java
Although this one has probably much more than you need and has (I think) some links into the Android framework itself, so you cannot really build it as a separate module the way it is now.
Hope that helps

Android stops suggesting words

I'm working on a mobile version of the chatroom my website (just a website, not an android application), and the first time I loaded that page on my Motorola DROID everything acted as expected:
click on the input field to select it
tap the same field again to open up the keyboard
start typing
auto complete words are suggested gray-on-white right above the keyboard
After a few refreshes of the page step 4 does not happen! There is no white bar above the keyboard, and no suggestions come up.
I cannot figure out what may be causing it, or how to test it. I downloaded Dolphin browser, and the keyboard behaves correctly the first time, but not the following times (just like default).
All suggestions are welcome.
Edit Apr 8:
As requested a link to the website: http://phantasyrpg.com will redirect to http://mobile.phantasyrpg.com -- you will need to register and visit the "Tavern" from the menu on top left.
Edit Apr 10:
I've created a very empty example that has the same issue:
http://mobile.phantasyrpg.com/test-chat.html I'm also noticing this on other pages as long as the URI is the same -- there's this issue. If there's a GET parameter that's different, suggestions come up correctly.
I'm wondering if there's some setting in my Apache that sends some silly or broken header. But I don't know much about headers.
I've had this happen before... that are workarounds when using a WebView, but AFAIK there's no way to fix this in just a plain site. But basically, there's some sort of cache or something that exists in the browser tab. At first (new tab) auto-complete always works for me. After staying on the same domain in the same tab for a while, it all crashes. For me specifically, after this point the number '7' on the keyboard will sometimes make the browser segfault =\
If you look around the net, you will notice countless bugs filed for the issues showing up in almost all major websites. All complaining the auto-complete stops on Android. I'm pretty it's global, and unstoppable.

Categories

Resources