Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20] API - Titanium.UI.createTextField

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:50:08.000+0000
Affected Version/sn/a
Fix Version/sGA - M1
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:22:37.000+0000
Updated2011-04-17T01:50:08.000+0000

Description

Description

The purpose of this API is to create a text field native control.

Example


var textField = Titanium.UI.createTextField({id:'foo', value:'bar'});
textField.addEventListener('change',function(e)
{
    e.value // current value of text field
});

// support return event listener (when return key is clicked)
textField.addEventListener('return',function(e)
{
   // values are e.value
});

API Arguments - These should apply to TextArea where applicable

id : optional. HTML element id for where the text field will be placed if placed in webview

value : optional. initial value of text field

color : optional. text color

backgroundColor : optional. background color of field

enableReturnKey : optional. default is false. valid values are true or false. disable return key when field is blank

returnKeyType : optional. valid values are: Titanium.UI.RETURNKEY_GO | Titanium.UI.RETURNKEY_GOOGLE | Titanium.UI.RETURNKEY_JOIN | Titanium.UI.RETURNKEY_NEXT | Titanium.UI.RETURNKEY_ROUTE | Titanium.UI.RETURNKEY_SEARCH | Titanium.UI.RETURNKEY_YAHOO | Titanium.UI.RETURNKEY_DONE | Titanium.UI.RETURNKEY_EMERGENCY_CALL

keyboardType : optional. valid values are: Titanium.UI.KEYBOARD_ASCII | Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION | Titanium.UI.KEYBOARD_URL | Titanium.UI.KEYBOARD_NUMBER_PAD | Titanium.UI.KEYBOARD_PHONE_PAD | Titanium.UI.KEYBOARD_EMAIL_ADDRESS

autocorrect : optional. default is true. valid values are true or false. determines if autocorrection is turned on for text

hintText : optional. hint text for a field. (this is the placeholder attribute for iphone)

textAlign : optional. default is left. valid values are: "left", "right" and "center"

clearOnEdit : optional. default is false. clear input field when editing begins

borderStyle : optional. valid values are: Titanium.UI.INPUT_BORDERSTYLE_NONE | Titanium.UI.INPUT_BORDERSTYLE_LINE | Titanium.UI.INPUT_BORDERSTYLE_BEZEL | Titanium.UI.INPUT_BORDERSTYLE_ROUNDED

clearButtonMode : optional. valid values are: Titanium.UI.INPUT_BUTTONMODE_NEVER | Titanium.UI.INPUT_BUTTONMODE_ALWAYS | Titanium.UI.INPUT_BUTTONMODE_ONFOCUS | Titanium.UI.INPUT_BUTTONMODE_ONBLUR leftButton : optional. button to display to the left of the input field

leftButtonMode : optional. valid values are: Titanium.UI.INPUT_BUTTONMODE_NEVER | Titanium.UI.INPUT_BUTTONMODE_ALWAYS | Titanium.UI.INPUT_BUTTONMODE_ONFOCUS | Titanium.UI.INPUT_BUTTONMODE_ONBLUR

rightButton : optional. button to display to the right of the input field

rightButtonMode : optional. valid values are: Titanium.UI.INPUT_BUTTONMODE_NEVER | Titanium.UI.INPUT_BUTTONMODE_ALWAYS | Titanium.UI.INPUT_BUTTONMODE_ONFOCUS | Titanium.UI.INPUT_BUTTONMODE_ONBLUR

Comments

No comments

JSON Source