Android Date Script - Titanium Mobile App -
i have form on app trying forcefulness particular format on text field (ex. dob 11/33/1944). next code works great on iphone on android app stops working 1 time come in first number. can please help me modify code works both iphone , android. help.
i have file called global.js have code forces format. using:
mask = { mask: function(_field, _function) { _field.value = _function(_field.value); }, dob: function(v) { v = v.replace(/\d/g,""); v = v.replace(/^(\d\d)(\d)/g,"$1/$2"); v = v.replace(/(\d{2})(\d)/,"$1/$2"); homecoming v.slice(0, 10); }, phone: function(v) { v = v.replace(/\d/g,""); v = v.replace(/^(\d\d)(\d)/g,"($1) $2"); v = v.replace(/(\d{4})(\d)/,"$1-$2"); homecoming v.slice(0, 14); } };
on form added next on top of of view global.js:
var styles = require('global').styles;
then field follows:
// create textfield. var atextfield_dob = ti.ui.createtextfield( { top : "10%", width : '80%', height:'8%', color: styles.textfield.color, font : { fontsize : font_text }, hinttext : 'date of birth (ex.01/01/1999)', paddingleft : styles.textfield.paddingleft, backgroundimage : styles.textfielda.backgroundimage, }); // hear homecoming events. atextfield_dob.addeventlistener('change', function(e) { mask.mask(atextfield_dob, mask.dob); });
here issue on android device, keeps repeating , app has forced stop:
[warn] : iinputconnectionwrapper: getcursorcapsmode on inactive inputconnection
first of all, i’d avoid issue altogether using date picker control. that’d improve ui/ux anyway.
it’s probable creating infinite recursion in alter event. avoided using blur (lost focus) event, or keypressed event if can’t wait until focus lost.
i’m not sure if regular look engines different. seek putting regex output command or log – separate possible alter event infinite loop test out.
android titanium-mobile appcelerator
No comments:
Post a Comment