Textfield that only admits text

You must Login before you can answer or comment on any questions.

Hi, I am developing for Android and iPhone wit Titanium Studio 1.0.7.201112152014

I want that a textfield only admits text. I mean no numbers and no symbols. I know that I can do it by checking if the text.addEventListner('change'... But I want that the user hasn't the oportunity to write a number or a symbol, just text. It's like customize my own keyboard. Is it posible? PS: Sorry about my english.

2 Answers

Accepted Answer

The alternative is to create a custom made keyboad, with buttons.

— answered 1 year ago by Daniel Urstöger
answer permalink
3 Comments
  • I have only one week with Titanium, I don't know how to start with my custom keyboard. But it's a good idea! I will try it.

    Thanks Daniel.

    — commented 1 year ago by Beto Garcia

  • well, I am not entirely certain, but I would start with Ti.UI.createButton, I would create two or three arrays (depending on how many rows you want the keyboard to have) with the button data and add them via a loop to a view which you can move / hide as you like.

    — commented 1 year ago by Daniel Urstöger

  • Thanks John! I will try it, I can make a view with the buttons, my problem is when I set the focus on a textfield, I can show that view with my keyboard and capture each click. But when the focus is in the textfield I have two keyboards in the screen. My keyboard and the device keyboard.

    I can hide the device keyboard with textfield.blur(), but when the blur event is fired I want to hide my keyboard too.

    There are an alternative to hide the device keyboard?

    Thanks again!!

    — commented 1 year ago by Beto Garcia

You can check for numbers and symbols using Javascript. Unfortunately you can only use the keyboards that Apple provides. You can try various different keyboards by specifying a keyboard type

keyboardType:Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION

I suggest you try the various keyboards availible to you, look in the API documentation under Titanium.UI.

Sincerely,

John J. Donna II,

— answered 1 year ago by John Donna
answer permalink
1 Comment
  • Yes I had tried all the keyboards, but there isn't any like I want. So I will have to check the numbers and symbols using javascript like you say.

    Thanks John.

    — commented 1 year ago by Beto Garcia

Your Answer

Think you can help? Login to answer this question!