GraffitiTextField

View Categories

Enumerations #

NameValues
AlignmentsLeft
Right
Center
CaseModifiersNone
Lower
Upper
EnterKeyHintsEnter
Done
Go
NextFocus
PreviousFocus
Search
Send
FieldTypesText
Color
Date
DateTime
DateTimeLocal
Email
Number
Password
Telephone
Time
Url
Week
PositionsLeft
Right
StatesUnvalidated
Valid
Invalid

Constants #

This class exposes no constants.

Events #

DefinitionParametersReturn TypeDescription
EnterPressedNoneNoneRaised when the user presses the Enter key on their keyboard while the field has focus. Simultaneously updates the value server-side. Prevents Default button action.
LabelPressedNoneNoneRaised when the user clicks the label.
StateChangedNoneNoneRaised when the user’s text has changed the State of the field based on the supplied Pattern.
ValueChangedNoneNoneRaised when the user changes the value of the field.

Methods #

DefinitionParametersReturn TypeDescription
AddValuevalue as StringNoneAdds a new value to the autocomplete array.
AddValueAtindex as Integer
value as String
NoneAdds a new value to the autocomplete array at the specified index.
IndexOfValuevalue as StringIntegerReturns the index of the specified value within the autocomplete array.
LastValueIndexNoneIntegerReturns the index of the last item within the autocomplete array.
RemoveAllValuesNoneNoneRemoves all values from the autocomplete array.
RemoveValueAtindex as IntegerNoneRemoves the value at the specified index from the autocomplete array.
SelectAllNoneNoneSelects all content within the field.

Properties #

NameTypeDefault ValueDescription
AllowLineFeedBooleanFalseControls whether users can enter line feeds by pressing the enter key. Does not affect the EnterPressed event. Applies only when Multiple = True.
AllowLineWrappingBooleanTrueControls whether content lines are wrapped. Applied only when Multiple = True.
AllowTabsBooleanFalseControls whether users are allowed to enter tab characters by pressing the Tab key or remove tabs by pressing Shift+Tab. Applies only when Multiple = True. When True, tab progression from this control to other controls will not function.
AutocompleteHighlightTypedBooleanTrueHighlights typed text within the autocomplete results dropdown.
AutocompleteMaximumItemsInteger5Maximum number of items to display in the autocomplete results dropdown.
AutocompleteSearchThresholdInteger2Number of characters required to be input for autocomplete to process.
CaseModifierCaseModifiersNoneControls the capitalization of value text. Also applies to Placeholder.
EnterKeyHintEnterKeyHintsEnterText to display in the Enter button of mobile/virtual keyboards.
FieldStyleGraffitiStyleNilStyle applied to the field portion of the class.
IconHeightInteger16Height of IconObject when specified.
IconObjectPictureNilCustom icon displayed in the label portion. Signify location using <icon> in Label text.
IconWidthInteger16Width of IconObject when specified.
LabelString“Untitled”Caption of the label portion of the control. Supports FontAwesome icons, IE: <fas fa-search>
LabelAlignmentGraffitiTextField.AlignmentsLeftAlignment of text and icons in the label portion of the field.
LabelPositionPositionsLeftThe location of the label in relation to the field.
LabelStyleGraffitiStyleNilStyle applied to the label portion of the class.
LabelVisibleBooleanTrueWhen False, only the text field portion of the component will be displayed.
LabelWidthInteger-1Static width of label portion. -1 for auto.
MaxLengthInteger-1Maximum number of characters that the field can contain. Set to -1 for the maximum HTML limit of 524288.
MultilineBooleanFalseWhen True, the user may enter multiple lines of text within the component. Some other features or functionality may not be operational under these conditions due to browser limitations.
PatternString“”For using the browser’s built-in RegEx validation (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern).
PatternInvalidMessageString“”Text to display when the entered text does not confirm to the supplied Pattern. Empty string uses browser default.
PatternSetsStateBooleanTrueDetermines whether the conformity of the input text to the supplied Pattern will change the State of the control to be visibly valid or invalid.
ReadOnlyBooleanFalseIf True users cannot edit the contents of the field.
RequiredBooleanFalseHas no effect on display or function. Can be used to programmatically validate forms.
SelectedTextString“”Returns the currently selected text.
SelectionLengthInteger0Length of the currently selected text.
SelectionStartInteger0Start position of the current selection.
SpellCheckBooleanTrueControls whether spell checking is enabled on the field.
StateStatesUnvalidatedThe validation state of the field.
TypeFieldTypesTextThe type of field, not all types are supported by all browsers.
ValueString“”The value of the field. Updates on focus loss to reduce communication with the server.

Examples #

State #

This snippet changes the state of the field based on the length of the field’s text:

if me.Value.Length > 3 then
  me.State = GraffitiTextField.States.Valid
elseif me.Value.Length <> "" then
  me.State = GraffitiTextField.States.Invalid
else
  me.State = GraffitiTextField.States.Unvalidated
end if

Notes #

Autocomplete and Type = Search #

GraffitiTextField’s Autocomplete functionality should not be used with Type = Search due to a bug in Bootstrap and/or browser implementations. (See: https://github.com/twbs/bootstrap/issues/34411)

Mask Definitions #

CharacterAccepted Inputs
aAlpha character (a-z, A-Z)
9Numeric character (0-9)
*Alphanumeric character (a-z, A-Z, 0-9)
?Anything after the question mark is considered optional, and the MaskComplete event will fire with or without that section being filled.