Hi, I'm trying to set the maxLenght for textfiled but its not implanting on the while running the app.
this is my code:
" var tfadd = Ti.UI.createTextField({
width: 200,
height: 50, top: 220,
right: 60,
maxLength:25,
font:{fontsize:12},
hintText : 'Please enter your Address',
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
keyboardType : Ti.UI.KEYBOARD_DEFAULT,
returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
"
3 Answers
Accepted Answer
Hello Pratik,
android creates problem also with their properties many times.
if maxLength is not working then you can use custom solution for that like
check Text length at it's change event...
tfadd.addEventListener('change', function(e) { if (e.value.length > 25) e.source.value = e.source.oldValue; else e.source.oldValue = e.value; });Best Luck...
Thanks a lot Sarafaraz Babi..
its work for me...
Hi Sarafaraz,
Need one more help..
Can you just help me for auto increment data in my textfiled..
i.e if in database having one row data and its id is 1, now when i select new insert data the text field area should automatically increase by one..
thanks in advance...
Your Answer
Think you can help? Login to answer this question!