PasswordField

From WebOS101

Jump to: navigation, search

Contents

Introduction

Declaration

<div x-mojo-element="PasswordField" id="passwordFieldId" class="passwordClass" name="passwordName"></div>
Properties Required Value Description
x-mojo-element Required PasswordField Declares the widget as type 'PasswordField'
id Required Any String Identifies the widget element for use when instantiating or rendering
class Optional Any String Provide your own unique class and override the frameworks styles
name Optional Any String Add a unique name to the widget; generally used in templates when used


Events

Mojo.Event.listen(this.controller.get("passwordFieldId"), Mojo.Event.propertyChange, this.handleUpdate);
Event Type Value Event Handling
Mojo.Event.propertyChange {model:model, property:property, value:value, oldValue: oldValue, originalEvent: originalEvent}


Instantiation

this.controller.setupWidget("passwordFieldId",
this.attributes = {
hintText: $L("Type Password")
},
this.model = {
value: ""
}
);


Attribute Properties

Attribute Property Type Required Default Description
modelProperty String Optional value Model property name for selector value
hintText String Optional None Initially displayed string; supplanted by model value if supplied
textFieldName String Optional None DEPRECATED If supplied, the textarea will have this name, so that when it is serialized, the property can be easily pulled out
inputName String Optional None If supplied, the textarea will have this name, so that when it is serialized, the property can be easily pulled out
charsAllow Function Optional None Function must return 'true' to allow input character, or 'false' if not allowed; note: this event is sent as a result of a keyPress event, so you must check against key codes matching ASCII characters.
focus Boolean Optional FALSE DEPRECATED If true, field has focus on scene push
autoFocus Boolean Optional FALSE If true, field has focus on scene push
modifierState String Optional None initial state of modifier keys for this field. Can be:
Mojo.Widget.numLock (uses the "Num" character equivalent for all characters typed),
Mojo.Widget.capsLock
autoResize Boolean Optional FALSE DEPRECATED Automatically grow field horizontally
growWidth Boolean Optional FALSE Automatically grow field horizontally
autoResizeMax Integer Optional None Maximum width of field
enterSubmits Boolean Optional FALSE When used in conjunction with multline, if this is set, then enter will submit rather than newline
limitResize Boolean Optional FALSE Limit height resize (scrolls text rather than grow field)
preventResize Boolean Optional FALSE There will be no resizing in any dimension
holdToEnable Boolean Optional FALSE if the passwordfield is disabled, tapping and holding and releasing will enable it; if disabled is not set, this is ignored
focusMode String Optional Sets the cursor mode when the field gets focus. Options are:
Mojo.Widget.focusSelectMode
Mojo.Widget.focusInsertMode
Mojo.Widget.focusAppendMode
Text will either all be selected (Select), or a cursor will appear where the user tapped (Insert) or the cursor will go to end of text (Append)
changeOnKeyPress Boolean Optional FALSE If true, sends a propertyChange event on every character change to a field; otherwise only when focus lost
textReplacement Boolean Optional TRUE DEPRECATED Whether to enable the SmartTextEngine services of PalmSysMgr. Enabled by default in the TextField.
maxLength Integer Optional No Limit Maximum character length of field; does not apply to multiline fields where an exception will be thrown.
requiresEnterKey Boolean Optional FALSE Required Enter key to submit; other navigation will not genterate submit event
holdToEdit Boolean Optional FALSE Tap and Hold to focus/edit; Tap only will be ignored
autoCapitalization Boolean Optional FALSE DEPRECATED The first letter of each word (determined by whitespace) is capitalized.


Model Properties

Model Property Type Required Default Description
value String Required Null Initial and updated value of widget


Methods

Method Arguments Description
focus none Focus the input part of the text field
blur none Blur the input part of the text field
getValue none Get the plaintext value of the text field
setText String DEPRECATED Set the plaintext value of the text field; also used by alt char picker to set the value
setValue String Set the plaintext value of the text field
getCursorPosition none Returns on object with {selectionStart: int, selectionEnd: int} that describe the position of the cursor; if start is not equal to end, then there is text selected
setCursorPosition start, end Set the cursor position in the input portion of the textfield; if start and end are not the same, then this will select the text between START and END; if start and/ or end occur in invalid positions, they will be changed to valid positions at the end of the text if they were larger than the size of the value, or at the beginning, if they are smaller than the size of the value; empty text will result in a cursor at the start of the textfield
Personal tools