[Control] textField

Part of: mobl::ui::generic

Arguments:

  • s : String variable/property to bind the control to.
  • placeholder : String = null placeholder text (appears when text field is empty, optional)
  • label : String = null label text (optional)
  • validator : Function1<String,String> = alwaysOkValidator validator function, takes s as argument and returns error message or empty string if OK (optional)
  • style : Style = textFieldStyle the style to use for the text field
  • invalidStyle : Style = textFieldInvalidStyle the style to use for the text field on invalid input
  • autofocus : Bool = false whether the control should get immediately get focus when loaded.
  • autocorrect : Bool = true whether auto correction should be enabled or not.
  • autocapitalize : Bool = true whether auto capitalization should be enabled or not.
  • autocomplete : Bool = true whether auto completion should be enabled or not.

  • onchange : Callback = null event triggered when the text field changed and loses focus (optional).

  • onkeyup : Callback = null event triggered on every keypress (optional).

A text field control.

Example:

var s = ""
group {
  item { textField(s, label="Name") }
}

Example 2:

function validateLength(s : String) : String {
  return s.length < 50 ? "" : "Max length: 50";
}
...
group {
  item { textField(name, validator=validateLength) }
}
mobl/ui/generic/textfield.txt · Last modified: 2013/10/01 02:29 (external edit)