[TIMOB-16176] Android: Cannot change TextField value in change event handler
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, change, textfield |
Reporter | Natasha Pecanova |
Assignee | Eric Merriman |
Created | 2013-10-24T07:05:58.000+0000 |
Updated | 2019-04-30T14:16:00.000+0000 |
Description
changing the value of the text field in change handler is not possible.
textField.addEventListener("change", function(){
textField.value = textField.value.replace(/some regex/,"");
}
this code is crushing whole device. I have to restart the device.
Hi I tested this *change* event using the sample below. Can you please give my code a try to see if this solves your issue. If not, please post your test case so that we can help. *Test Environment* Titanium SDK 3.1.2 & SDK 3.1.3 GA android 4.2.2 Real device. *Test Case*
Hello, please provide a full test case. Best, Mauro
add one text field add change listener on IOS you will not have a problem on Android it recursively calls change handler function textField.addEventListener("change", function(){ textField.value = textField.value.replace(/,/g, '.'); } testing if there is a need of changing the value should solve the problem.
Natasha, a full test case is the entire code, an app.js that reproduces the issue. Best, Mauro
Reopening this ticket as we can reproduce this issue on Android platform. I had to shut down my phone as the application went into infinite recursion.
This bug also happens with version 3.4.0.GA.
Same problem in version 3.5.0... In native implementations are a lot of solutions... one of this solutions is edit theme for the editText and set the attribute "android:focusableInTouchMode=true" i don't know if this works... but i'll try and commend here.
i came with a patch solution:
I hope this will help mean while you guys.
Just informing that problem exists: 5.3.1GA Android: 6.0.1 real device. onchange value changing gives infinity loop Thanks *Daniel Hernández Jara* your workaround works!
Still happens with the latest SDK
Not answering the problem, just a bit more elegant way to find your way around it using underscore.js:
The downside being not being able to type text rapidly and having to wait about a second before typing the cursor is in place again...
This problem exists in Android in the Titanium 7.0.1GA
Can we get someone to look at this please?
This is still an issue in 8.0.0.GA