Class TextItem
- All Implemented Interfaces:
HasHandlers
,HasBlurHandlers
,HasChangedHandlers
,HasChangeHandlers
,HasClickHandlers
,HasDoubleClickHandlers
,HasEditorEnterHandlers
,HasEditorExitHandlers
,HasFocusHandlers
,HasIconClickHandlers
,HasIconKeyPressHandlers
,HasItemHoverHandlers
,HasKeyDownHandlers
,HasKeyPressHandlers
,HasKeyUpHandlers
,HasPendingStatusChangedHandlers
,HasPickerIconClickHandlers
,HasShowContextMenuHandlers
,HasTitleClickHandlers
,HasTitleDoubleClickHandlers
,HasTitleHoverHandlers
,HasValueHoverHandlers
,HasValueIconClickHandlers
- Direct Known Subclasses:
ColorItem
,ComboBoxItem
,DoubleItem
,FloatItem
,IntegerItem
,PasswordItem
,SpinnerItem
,UploadItem
-
Nested Class Summary
Nested classes/interfaces inherited from class com.smartgwt.client.widgets.form.fields.FormItem
FormItem.CustomStateGetter, FormItem.StateCustomizer
-
Field Summary
Fields inherited from class com.smartgwt.client.widgets.form.fields.FormItem
configOnly, scClassName, warnOnEditorTypeConversion, warnOnEditorTypeConversionDefault
Fields inherited from class com.smartgwt.client.core.RefDataClass
id
Fields inherited from class com.smartgwt.client.core.DataClass
factoryCreated, factoryProperties
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
changeAutoChildDefaults
(String autoChildName, Canvas defaults) Changes the defaults for Canvas AutoChildren namedautoChildName
.static void
changeAutoChildDefaults
(String autoChildName, FormItem defaults) Changes the defaults for FormItem AutoChildren namedautoChildName
.static void
changePickerIconDefaults
(FormItemIcon defaults) void
If this item currently has focus, clear the current selection.void
deselectValue
(Boolean start) If this item currently has focus, clear the current selection.In Mobile Safari, should automatic correction be offered for text in the item's text box? Ifnull
, then Mobile Safari determines automatically whether to enable autocorrect.This property corresponds to the HTML5 "inputType" attribute applied to the <input> element for this TextItem.Should this form item fire itschange
handler (and store its value in the form) on every keypress? Set tofalse
to suppress the 'change' handler firing (and the value stored) on every keypress.Should entered characters be converted to upper or lowercase? Also applies to values applied withFormItem.setValue()
.Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.boolean
If alength
is specified for this item, should user input be limited to the specified length? If set to true, user input and values passed tosetValue()
will be trimmed to the specified length.Returns the raw text value that currently appears in the text field, which can differ fromFormItem.getValue()
in various cases - for example: for items that constrain the value range, such as aDateItem
withenforceDate
:true, or aComboBoxItem
withaddUnknownValues
:false for items with a defined valueMap or edit value formatter and parser functions which converts display value to data value while the item has focus ifchangeOnKeypress
is falseBy default HTML characters will be escaped whencanEdit
is false andreadOnlyDisplay
is "static", so that the raw value of the field (for example"<b>AAA</b>"
) is displayed to the user rather than the interpreted HTML (for example"AAA"
).If this form item has a specifiedFormItem.optionDataSource
, should the item ever perform a fetch against this dataSource to retrieve the related record.WithformatOnBlur
enabled, this textItem will format its value according to the rules described inFormItem.mapValueToDisplay()
as long as the item does not have focus.ShouldFormItem.formatEditorValue()
re-run whenever this item recieves or loses focus? Setting this property allows developers to conditionally format the display value based on item.hasFocus, typically to display a longer, more informative string while the item does not have focus, and simplifying it down to an easier-to-edit string when the user puts focus into the item.getHint()
Returns the hint text for this item.Sets a keypress filter regular expression to limit valid characters that can be entered by the user.If set, the maximum number of characters for this field.getMask()
Input mask used to restrict and format text within this item.During entry into amasked field
, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.Character that is used to fill required emptymask
positions to display text while control has no focus.Character that is used to fill required emptymask
positions to display text while control has focus.Should enteredmask
value be saved with embedded literals?static TextItem
getOrCreateRef
(JavaScriptObject jsObj) When generating a print-view of the component containing this TextItem, should the form item expand to accommodate its value? If set to false the text box will not expand to fit its content in the print view, instead showing exactly as it does in the live form.Text items will submit their containing form on enter keypress ifsaveOnEnter
is true.int[]
For text-based items, this method returns the indices of the start/end of the current selection if the item currently has the focus.Allows theselectOnClick
behavior to be configured on a per-FormItem basis.Allows theselectOnFocus
behavior to be configured on a per-FormItem basis.Ifshowing a hint for this form item
, should the hint be shown within the field?boolean
When set to false, prevents this item's input element from being written into the DOM.boolean
Does the current formItem support native cut and paste events?This attribute currently only has an effect in Internet Explorer.Base CSS class name for this item's input element.boolean
Ifshowing the hint in field
and if supported by the browser, should the HTML5placeholder
attribute be used to display the hint within the field? If set tofalse
, then use of theplaceholder
attribute is disabled and an alternative technique to display the hint in-field is used instead.Return the value tracked by this form item.boolean
pendingStatusChanged
(DynamicForm form, FormItem item, boolean pendingStatus, Object newValue, Object value) Notification method called whenshowPending
is enabled and this text item should either clear or show its pending visual state.void
Put focus in this item and select the entire value.setBrowserAutoCapitalize
(Boolean browserAutoCapitalize) Note : This is an advanced settingsetBrowserAutoCorrect
(Boolean browserAutoCorrect) In Mobile Safari, should automatic correction be offered for text in the item's text box? Ifnull
, then Mobile Safari determines automatically whether to enable autocorrect.setBrowserInputType
(String browserInputType) This property corresponds to the HTML5 "inputType" attribute applied to the <input> element for this TextItem.setChangeOnKeypress
(Boolean changeOnKeypress) Should this form item fire itschange
handler (and store its value in the form) on every keypress? Set tofalse
to suppress the 'change' handler firing (and the value stored) on every keypress.setCharacterCasing
(CharacterCasing characterCasing) Should entered characters be converted to upper or lowercase? Also applies to values applied withFormItem.setValue()
.static void
setDefaultProperties
(TextItem textItemProperties) Class level method to set the default properties of this class.setEditProxyConstructor
(String editProxyConstructor) Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.setEnforceLength
(boolean enforceLength) If alength
is specified for this item, should user input be limited to the specified length? If set to true, user input and values passed tosetValue()
will be trimmed to the specified length.setEscapeHTML
(Boolean escapeHTML) By default HTML characters will be escaped whencanEdit
is false andreadOnlyDisplay
is "static", so that the raw value of the field (for example"<b>AAA</b>"
) is displayed to the user rather than the interpreted HTML (for example"AAA"
).setFetchMissingValues
(Boolean fetchMissingValues) If this form item has a specifiedFormItem.optionDataSource
, should the item ever perform a fetch against this dataSource to retrieve the related record.setFormatOnBlur
(Boolean formatOnBlur) WithformatOnBlur
enabled, this textItem will format its value according to the rules described inFormItem.mapValueToDisplay()
as long as the item does not have focus.setFormatOnFocusChange
(Boolean formatOnFocusChange) ShouldFormItem.formatEditorValue()
re-run whenever this item recieves or loses focus? Setting this property allows developers to conditionally format the display value based on item.hasFocus, typically to display a longer, more informative string while the item does not have focus, and simplifying it down to an easier-to-edit string when the user puts focus into the item.setKeyPressFilter
(String keyPressFilter) Sets a keypress filter regular expression to limit valid characters that can be entered by the user.If set, the maximum number of characters for this field.Input mask used to restrict and format text within this item.setMaskOverwriteMode
(Boolean maskOverwriteMode) During entry into amasked field
, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.setMaskPadChar
(String maskPadChar) Character that is used to fill required emptymask
positions to display text while control has no focus.setMaskPromptChar
(String maskPromptChar) Character that is used to fill required emptymask
positions to display text while control has focus.setMaskSaveLiterals
(Boolean maskSaveLiterals) Should enteredmask
value be saved with embedded literals?void
setPastedValueTransformer
(PastedValueTransformer customizer) Notification fired in response to a clipboard "paste" event on freeform text items, giving developers an opportunity to reformat the pasted text.setPrintFullText
(Boolean printFullText) When generating a print-view of the component containing this TextItem, should the form item expand to accommodate its value? If set to false the text box will not expand to fit its content in the print view, instead showing exactly as it does in the live form.setSaveOnEnter
(Boolean saveOnEnter) Text items will submit their containing form on enter keypress ifsaveOnEnter
is true.void
setSelectionRange
(int start, int end) Puts focus into this form item and selects characters between the given indices.setSelectOnClick
(Boolean selectOnClick) Allows theselectOnClick
behavior to be configured on a per-FormItem basis.setSelectOnFocus
(Boolean selectOnFocus) Allows theselectOnFocus
behavior to be configured on a per-FormItem basis.setShowHintInField
(Boolean showHintInField) Ifshowing a hint for this form item
, should the hint be shown within the field?setShowInputElement
(boolean showInputElement) When set to false, prevents this item's input element from being written into the DOM.setSupportsCutPasteEvents
(boolean supportsCutPasteEvents) Does the current formItem support native cut and paste events?setSuppressBrowserClearIcon
(Boolean suppressBrowserClearIcon) This attribute currently only has an effect in Internet Explorer.setTextBoxStyle
(String textBoxStyle) Base CSS class name for this item's input element.setUsePlaceholderForHint
(boolean usePlaceholderForHint) Ifshowing the hint in field
and if supported by the browser, should the HTML5placeholder
attribute be used to display the hint within the field? If set tofalse
, then use of theplaceholder
attribute is disabled and an alternative technique to display the hint in-field is used instead.shouldFetchMissingValue
(Object newValue) If this field has a specifiedoptionDataSource
, should we perform a fetch against that dataSource to find the record that matches this field's value?Methods inherited from class com.smartgwt.client.widgets.form.fields.FormItem
_getValue, addBlurHandler, addChangedHandler, addChangeHandler, addClickHandler, addDoubleClickHandler, addEditorEnterHandler, addEditorExitHandler, addFocusHandler, addIcon, addIcon, addIconClickHandler, addIconKeyPressHandler, addItemHoverHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addPendingStatusChangedHandler, addPickerIconClickHandler, addShowContextMenuHandler, addTitleClickHandler, addTitleDoubleClickHandler, addTitleHoverHandler, addValueHoverHandler, addValueIconClickHandler, applyFormula, asSGWTComponent, blurItem, canEditCriterion, checkFormItemType, clearErrors, clearValue, disable, disableIcon, enable, enableIcon, error, error, errorIfNotCreated, focusAfterItem, focusInItem, getAccessKey, getAlign, getAllowExpressions, getAlwaysFetchMissingValues, getAlwaysShowControlBox, getApplyAlignToText, getApplyHeightToTextBox, getAriaRole, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsObject, getAttributeAsString, getAutoComplete, getAutoCompleteKeywords, getBrowserSpellCheck, getCanEdit, getCanEditOpaqueValues, getCanFocus, getCanHover, getCanSelectText, getCanTabToIcons, getCanvasAutoChild, getCellHeight, getCellStyle, getClassName, getClipStaticValue, getClipTitle, getConfig, getContainerWidget, getControlStyle, getCriteriaField, getCriterion, getCriterion, getCursorPosition, getCustomState, getDataPath, getDateFormatter, getDecimalPad, getDecimalPrecision, getDefaultIconSrc, getDefaultOperator, getDefaultValue, getDestroyed, getDisabled, getDisabledHover, getDisableIconsOnReadOnly, getDisplayField, getDisplayFieldName, getDisplayValue, getDisplayValue, getEditorTypeConfig, getEditPendingCSSText, getEmptyDisplayValue, getEmptyValueIcon, getEndRow, getErrorIconHeight, getErrorIconProperties, getErrorIconSrc, getErrorIconWidth, getErrorMessageWidth, getErrors, getExportFormat, getFieldName, getFilterLocally, getForeignDisplayField, getForm, getFormat, getFormItemAutoChild, getFormula, getFullDataPath, getGlobalTabIndex, getGridColNum, getGridRowNum, getHeight, getHeightAsString, getHidden, getHintStyle, getHoverAlign, getHoverDelay, getHoverFocusKey, getHoverHeight, getHoverHeightAsString, getHoverOpacity, getHoverPersist, getHoverStyle, getHoverVAlign, getHoverWidth, getHoverWidthAsString, getIcon, getIconBaseStyle, getIconHeight, getIconHSpace, getIconPageRect, getIconPrompt, getIconRect, getIcons, getIconTabPosition, getIconVAlign, getIconWidth, getID, getImageURLPrefix, getImageURLSuffix, getImplicitSave, getImplicitSaveOnBlur, getInputFormat, getLeft, getLinearColSpan, getLinearColSpanAsString, getLinearEndRow, getLinearEndRowAsString, getLinearStartRow, getLinearStartRowAsString, getLinearWidth, getLinearWidthAsString, getListGrid, getLoadingDisplayValue, getLocateItemBy, getMinHintWidth, getMultiple, getMultipleValueSeparator, getName, getNullOriginalValueText, getOperator, getOptionCriteria, getOptionDataSource, getOptionDataSourceAsString, getOptionFilterContext, getOptionOperationId, getOptionTextMatchStyle, getOriginalValueMessage, getPageLeft, getPageRect, getPageTop, getPaletteDefaults, getPicker, getPickerIcon, getPickerIcon, getPickerIconHeight, getPickerIconName, getPickerIconPrompt, getPickerIconProperties, getPickerIconSrc, getPickerIconStyle, getPickerIconTabPosition, getPickerIconWidth, getPixelHeight, getPixelWidth, getPrintReadOnlyTextBoxStyle, getPrintTextBoxStyle, getPrintTitleStyle, getPrompt, getReadOnlyCanSelectText, getReadOnlyControlStyle, getReadOnlyDisplay, getReadOnlyHover, getReadOnlyTextBoxStyle, getReadOnlyWhen, getRect, getRedrawOnChange, getRejectInvalidValueOnChange, getRequired, getRequiredMessage, getRequiredWhen, getRowSpan, getScClassName, getSelectedRecord, getShouldSaveValue, getShowClippedTitleOnHover, getShowClippedValueOnHover, getShowDeletions, getShowDisabled, getShowDisabledIconsOnFocus, getShowDisabledPickerIconOnFocus, getShowErrorIcon, getShowErrorIconInline, getShowErrorStyle, getShowErrorText, getShowFocused, getShowFocusedErrorState, getShowFocusedIcons, getShowFocusedPickerIcon, getShowHint, getShowIcons, getShowIconsOnFocus, getShowImageAsURL, getShowOldValueInHover, getShowOver, getShowOverIcons, getShowPending, getShowPickerIcon, getShowPickerIconOnFocus, getShowRTL, getShowTitle, getShowValueIconOnly, getStartRow, getStaticHeight, getStopOnError, getStoreDisplayValues, getSuppressValueIcon, getSynchronousValidation, getTabIndex, getTextAlign, getTextFormula, getTimeFormatter, getTitle, getTitleAlign, getTitleColSpan, getTitleOrientation, getTitleStyle, getTitleVAlign, getTooltip, getTop, getType, getUpdateControlOnOver, getUpdatePickerIconOnOver, getUpdateTextBoxOnOver, getUseAdvancedCriteria, getUseDisabledHintStyleForReadOnly, getUseLocalDisplayFieldValue, getValidateOnChange, getValidateOnExit, getValidOperators, getVAlign, getValue, getValueAsFloat, getValueAsInteger, getValueAsLong, getValueAsRecordList, getValueDeselectedCSSText, getValueField, getValueFieldName, getValueIconHeight, getValueIconLeftPadding, getValueIconRightPadding, getValueIconSize, getValueIconWidth, getValueMap, getValueMapAsArray, getVisible, getVisibleHeight, getVisibleTitleWidth, getVisibleWhen, getVisibleWidth, getWarnOnEditorTypeConversion, getWarnOnEditorTypeConversionDefault, getWidth, getWidthAsString, getWrapHintText, getWrapStaticValue, getWrapTitle, handleWarnOnEditorTypeConversion, hasAdvancedCriteria, hasErrors, hide, hideIcon, invalidateDisplayValueCache, isAssignableFrom, isConfigOnly, isCreated, isCutEvent, isDisabled, isDrawn, isFocused, isInGrid, isPasteEvent, isVisible, linkToInstanceUponCreate, mapDisplayToValue, mapValueToDisplay, mapValueToDisplay, mapValueToDisplay, redraw, redraw, removeIcon, selectedRecordChanged, setAccessKey, setAlign, setAllowExpressions, setAlwaysFetchMissingValues, setAlwaysShowControlBox, setApplyAlignToText, setApplyHeightToTextBox, setAriaRole, setAriaState, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoChildConstructor, setAutoChildProperties, setAutoChildProperties, setAutoChildProperties, setAutoChildVisibility, setAutoComplete, setAutoCompleteKeywords, setBrowserSpellCheck, setCanEdit, setCanEditCriterionPredicate, setCanEditOpaqueValues, setCanFocus, setCanHover, setCanSelectText, setCanTabToIcons, setCellHeight, setCellStyle, setClipStaticValue, setClipTitle, setColSpan, setColSpan, setConfigOnly, setControlStyle, setCriteriaField, setCriterion, setCriterionGetter, setCriterionSetter, setCustomStateGetter, setDataPath, setDateFormatter, setDecimalPad, setDecimalPrecision, setDefaultIconSrc, setDefaultOperator, setDefaultProperties, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDisabled, setDisabledHover, setDisableIconsOnReadOnly, setDisplayField, setDisplayFormat, setDisplayFormat, setEditorProperties, setEditorType, setEditorType, setEditorType, setEditorValueFormatter, setEditorValueParser, setEditPendingCSSText, setEmptyDisplayValue, setEmptyValueIcon, setEndRow, setErrorFormatter, setErrorIconHeight, setErrorIconProperties, setErrorIconSrc, setErrorIconWidth, setErrorMessageWidth, setErrorOrientation, setErrors, setErrors, setExportFormat, setFilterLocally, setForeignDisplayField, setFormat, setFormula, setGlobalTabIndex, setHeight, setHeight, setHidden, setHint, setHintStyle, setHoverAlign, setHoverDelay, setHoverFocusKey, setHoverHeight, setHoverHeight, setHoverOpacity, setHoverPersist, setHoverStyle, setHoverVAlign, setHoverWidth, setHoverWidth, setIconBaseStyle, setIconDisabled, setIconHeight, setIconHSpace, setIconPrompt, setIcons, setIconShowOnFocus, setIconVAlign, setIconWidth, setID, setImageURLPrefix, setImageURLSuffix, setImplicitSave, setImplicitSaveOnBlur, setInitHandler, setInputFormat, setInputTransformer, setItemHoverFormatter, setItemTitleHoverFormatter, setItemValueHoverFormatter, setJavaScriptObject, setLeft, setLinearColSpan, setLinearColSpan, setLinearEndRow, setLinearEndRow, setLinearStartRow, setLinearStartRow, setLinearWidth, setLinearWidth, setLoadingDisplayValue, setLocateItemBy, setMinHintWidth, setMultiple, setMultipleValueSeparator, setName, setNullOriginalValueText, setNullProperty, setOperator, setOptionCriteria, setOptionDataSource, setOptionDataSource, setOptionFilterContext, setOptionOperationId, setOptionTextMatchStyle, setOriginalValueMessage, setPickerIconHeight, setPickerIconName, setPickerIconPrompt, setPickerIconProperties, setPickerIconSrc, setPickerIconStyle, setPickerIconWidth, setPrintReadOnlyTextBoxStyle, setPrintTextBoxStyle, setPrintTitleStyle, setPrompt, setProperty, setProperty, setProperty, setProperty, setProperty, setReadOnlyCanSelectText, setReadOnlyControlStyle, setReadOnlyDisplay, setReadOnlyHover, setReadOnlyTextBoxStyle, setReadOnlyWhen, setRedrawOnChange, setRejectInvalidValueOnChange, setRequired, setRequiredMessage, setRequiredWhen, setRowSpan, setScClassName, setShouldSaveValue, setShowClippedTitleOnHover, setShowClippedValueOnHover, setShowDeletions, setShowDisabled, setShowDisabledIconsOnFocus, setShowDisabledPickerIconOnFocus, setShowErrorIcon, setShowErrorIconInline, setShowErrorStyle, setShowErrorText, setShowFocused, setShowFocusedErrorState, setShowFocusedIcons, setShowFocusedPickerIcon, setShowHint, setShowIcons, setShowIconsOnFocus, setShowIfCondition, setShowImageAsURL, setShowOldValueInHover, setShowOver, setShowOverIcons, setShowPending, setShowPickerIcon, setShowPickerIconOnFocus, setShowRTL, setShowTitle, setShowValueIconOnly, setStartRow, setStateCustomizer, setStaticHeight, setStopOnError, setStoreDisplayValues, setSuppressValueIcon, setSynchronousValidation, setTabIndex, setTextAlign, setTextFormula, setTimeFormatter, setTitle, setTitleAlign, setTitleColSpan, setTitleHoverFormatter, setTitleOrientation, setTitleStyle, setTitleVAlign, setTooltip, setTop, setType, setUpdateControlOnOver, setUpdatePickerIconOnOver, setUpdateTextBoxOnOver, setUseAdvancedCriteria, setUseDisabledHintStyleForReadOnly, setUseLocalDisplayFieldValue, setUseObjectFactoryForTypeFallback, setValidateOnChange, setValidateOnExit, setValidators, setValidOperators, setVAlign, setValue, setValue, setValue, setValue, setValue, setValue, setValueDeselectedCSSText, setValueField, setValueFormatter, setValueHoverFormatter, setValueIconHeight, setValueIconLeftPadding, setValueIconMapper, setValueIconRightPadding, setValueIcons, setValueIconSize, setValueIconWidth, setValueMap, setValueMap, setVisible, setVisibleWhen, setWarnOnEditorTypeConversion, setWarnOnEditorTypeConversionDefault, setWidth, setWidth, setWrapHintText, setWrapStaticValue, setWrapTitle, shouldApplyHeightToTextBox, shouldSaveOnEnter, shouldStopKeyPressBubbling, show, showIcon, showPicker, stopHover, storeValue, storeValue, updateState, validate, valueClipped
Methods inherited from class com.smartgwt.client.data.Field
getCanExport, getExportTitle, getSortByField, setCanExport, setExportTitle, setSortByField
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef, internalSetID
Methods inherited from class com.smartgwt.client.core.DataClass
applyFactoryProperties, doAddHandler, fireEvent, getAttributeAsDoubleArray, getAttributeAsElement, getAttributeAsIntArray, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsStringArray, getAttributes, getHandlerCount, isFactoryCreated, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
-
Constructor Details
-
TextItem
public TextItem() -
TextItem
-
TextItem
-
TextItem
-
-
Method Details
-
getOrCreateRef
-
changeAutoChildDefaults
Changes the defaults for Canvas AutoChildren namedautoChildName
.- Parameters:
autoChildName
- name of an AutoChild to customize the defaults for.defaults
- Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, seeSGWTProperties
.- See Also:
-
changeAutoChildDefaults
Changes the defaults for FormItem AutoChildren namedautoChildName
.- Parameters:
autoChildName
- name of an AutoChild to customize the defaults for.defaults
- FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, seeSGWTProperties
.- See Also:
-
changePickerIconDefaults
-
setBrowserAutoCapitalize
Note : This is an advanced setting
- Parameters:
browserAutoCapitalize
- New browserAutoCapitalize value. Default value is null- Returns:
TextItem
instance, for chaining setter calls
-
getBrowserAutoCapitalize
- Returns:
- Current browserAutoCapitalize value. Default value is null
-
setBrowserAutoCorrect
In Mobile Safari, should automatic correction be offered for text in the item's text box? Ifnull
, then Mobile Safari determines automatically whether to enable autocorrect.When enabled, Mobile Safari displays "autocorrect bubbles" to suggest automatic corrections:
Note : This is an advanced setting
- Parameters:
browserAutoCorrect
- New browserAutoCorrect value. Default value is null- Returns:
TextItem
instance, for chaining setter calls
-
getBrowserAutoCorrect
In Mobile Safari, should automatic correction be offered for text in the item's text box? Ifnull
, then Mobile Safari determines automatically whether to enable autocorrect.When enabled, Mobile Safari displays "autocorrect bubbles" to suggest automatic corrections:
- Returns:
- Current browserAutoCorrect value. Default value is null
-
setBrowserInputType
This property corresponds to the HTML5 "inputType" attribute applied to the <input> element for this TextItem.The only currently supported use of this attribute is hinting to touch-enabled mobile devices that a particular keyboard layout should be used. Even here, be careful; to take a random example, using type "number" on Android up to at least 3.2 leads to a keyboard with no "-" key, so negative numbers cannot be entered.
Valid values:
"text" Normal text keyboard "digits" Makes the text field more suitable for entering a string of digits 0 - 9. On iOS, this causes the virtual keyboard to show a numeric keypad with only "0", "1", "2", ..., "9", and delete keys. "email" Makes the text field more suitable for entering an e-mail address. On iOS, this causes the virtual keyboard to show special "@" and "." keys on the alphabetic keys screen. "tel" Makes the text field more suitable for entering a telephone number. On iOS, this causes the virtual keyboard to show a numeric keypad with a "+*#" key for displaying punctuation keys. "number" Makes the text field more suitable for entering a floating-point value. On iOS, this causes the virtual keyboard to start on the number and punctuation keys screen. NOTE: This is not an appropriate text input type for credit card numbers, postal codes, ISBNs, and other formats that are not strictly parsable as floating-point numbers. This is because the browser is required to perform floating-point value sanitization to ensure that the value is a valid floating-point number.
"url" Makes the text field more suitable for entering a URL. On iOS, this causes the virtual keyboard to show a special ".com" key. Any vendor-
specific valueIf a browser supports another input type. Note : This is an advanced setting
- Overrides:
setBrowserInputType
in classFormItem
- Parameters:
browserInputType
- New browserInputType value. Default value is null- Returns:
TextItem
instance, for chaining setter calls
-
getBrowserInputType
This property corresponds to the HTML5 "inputType" attribute applied to the <input> element for this TextItem.The only currently supported use of this attribute is hinting to touch-enabled mobile devices that a particular keyboard layout should be used. Even here, be careful; to take a random example, using type "number" on Android up to at least 3.2 leads to a keyboard with no "-" key, so negative numbers cannot be entered.
Valid values:
"text" Normal text keyboard "digits" Makes the text field more suitable for entering a string of digits 0 - 9. On iOS, this causes the virtual keyboard to show a numeric keypad with only "0", "1", "2", ..., "9", and delete keys. "email" Makes the text field more suitable for entering an e-mail address. On iOS, this causes the virtual keyboard to show special "@" and "." keys on the alphabetic keys screen. "tel" Makes the text field more suitable for entering a telephone number. On iOS, this causes the virtual keyboard to show a numeric keypad with a "+*#" key for displaying punctuation keys. "number" Makes the text field more suitable for entering a floating-point value. On iOS, this causes the virtual keyboard to start on the number and punctuation keys screen. NOTE: This is not an appropriate text input type for credit card numbers, postal codes, ISBNs, and other formats that are not strictly parsable as floating-point numbers. This is because the browser is required to perform floating-point value sanitization to ensure that the value is a valid floating-point number.
"url" Makes the text field more suitable for entering a URL. On iOS, this causes the virtual keyboard to show a special ".com" key. Any vendor-
specific valueIf a browser supports another input type. - Overrides:
getBrowserInputType
in classFormItem
- Returns:
- Current browserInputType value. Default value is null
-
setChangeOnKeypress
Should this form item fire itschange
handler (and store its value in the form) on every keypress? Set tofalse
to suppress the 'change' handler firing (and the value stored) on every keypress.Note: If
false
, the value returned bygetValue
will not reflect the value displayed in the form item element as long as focus is in the form item element.- Overrides:
setChangeOnKeypress
in classFormItem
- Parameters:
changeOnKeypress
- New changeOnKeypress value. Default value is true- Returns:
TextItem
instance, for chaining setter calls
-
getChangeOnKeypress
Should this form item fire itschange
handler (and store its value in the form) on every keypress? Set tofalse
to suppress the 'change' handler firing (and the value stored) on every keypress.Note: If
false
, the value returned bygetValue
will not reflect the value displayed in the form item element as long as focus is in the form item element.- Overrides:
getChangeOnKeypress
in classFormItem
- Returns:
- Current changeOnKeypress value. Default value is true
-
setCharacterCasing
Should entered characters be converted to upper or lowercase? Also applies to values applied withFormItem.setValue()
.Note: character casing cannot be used at the same time as a
mask
.Note : This is an advanced setting
- Parameters:
characterCasing
- New characterCasing value. Default value is TextItem.DEFAULT- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getCharacterCasing
Should entered characters be converted to upper or lowercase? Also applies to values applied withFormItem.setValue()
.Note: character casing cannot be used at the same time as a
mask
.- Returns:
- Current characterCasing value. Default value is TextItem.DEFAULT
- See Also:
-
setEditProxyConstructor
Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.- Overrides:
setEditProxyConstructor
in classFormItem
- Parameters:
editProxyConstructor
- New editProxyConstructor value. Default value is "TextItemEditProxy"- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getEditProxyConstructor
Default class used to construct theEditProxy
for this component when the component isfirst placed into edit mode
.- Overrides:
getEditProxyConstructor
in classFormItem
- Returns:
- Current editProxyConstructor value. Default value is "TextItemEditProxy"
- See Also:
-
setEnforceLength
If alength
is specified for this item, should user input be limited to the specified length? If set to true, user input and values passed tosetValue()
will be trimmed to the specified length. Otherwise values exceeding the specified length will raise an error on validation.Note that having this value set to true limits user interactivity in some ways. For example users would be unable to paste a longer string into the field for editing without seeing it be truncated.
- Parameters:
enforceLength
- New enforceLength value. Default value is true- Returns:
TextItem
instance, for chaining setter calls
-
getEnforceLength
public boolean getEnforceLength()If alength
is specified for this item, should user input be limited to the specified length? If set to true, user input and values passed tosetValue()
will be trimmed to the specified length. Otherwise values exceeding the specified length will raise an error on validation.Note that having this value set to true limits user interactivity in some ways. For example users would be unable to paste a longer string into the field for editing without seeing it be truncated.
- Returns:
- Current enforceLength value. Default value is true
-
setEscapeHTML
By default HTML characters will be escaped whencanEdit
is false andreadOnlyDisplay
is "static", so that the raw value of the field (for example"<b>AAA</b>"
) is displayed to the user rather than the interpreted HTML (for example"AAA"
). SettingescapeHTML
false will instead force HTML values in a textItem to be interpreted by the browser in that situation.- Overrides:
setEscapeHTML
in classFormItem
- Parameters:
escapeHTML
- New escapeHTML value. Default value is true- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getEscapeHTML
By default HTML characters will be escaped whencanEdit
is false andreadOnlyDisplay
is "static", so that the raw value of the field (for example"<b>AAA</b>"
) is displayed to the user rather than the interpreted HTML (for example"AAA"
). SettingescapeHTML
false will instead force HTML values in a textItem to be interpreted by the browser in that situation.- Overrides:
getEscapeHTML
in classFormItem
- Returns:
- Current escapeHTML value. Default value is true
- See Also:
-
setFetchMissingValues
If this form item has a specifiedFormItem.optionDataSource
, should the item ever perform a fetch against this dataSource to retrieve the related record.Note that for editable textItems, behavior differs slightly than for other item types as we will not issue fetches unless
FormItem.alwaysFetchMissingValues
has been set to true. SeeshouldFetchMissingValue()
for more details.Note : This is an advanced setting
- Overrides:
setFetchMissingValues
in classFormItem
- Parameters:
fetchMissingValues
- New fetchMissingValues value. Default value is true- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getFetchMissingValues
If this form item has a specifiedFormItem.optionDataSource
, should the item ever perform a fetch against this dataSource to retrieve the related record.Note that for editable textItems, behavior differs slightly than for other item types as we will not issue fetches unless
FormItem.alwaysFetchMissingValues
has been set to true. SeeshouldFetchMissingValue()
for more details.- Overrides:
getFetchMissingValues
in classFormItem
- Returns:
- Current fetchMissingValues value. Default value is true
- See Also:
-
setFormatOnBlur
WithformatOnBlur
enabled, this textItem will format its value according to the rules described inFormItem.mapValueToDisplay()
as long as the item does not have focus. Once the user puts focus into the item the formatter will be removed. This provides a simple way for developers to show a nicely formatted display value in a freeform text field, without the need for an explicitFormItem.formatEditorValue()
andFormItem.parseEditorValue()
pair.- Parameters:
formatOnBlur
- New formatOnBlur value. Default value is false- Returns:
TextItem
instance, for chaining setter calls
-
getFormatOnBlur
WithformatOnBlur
enabled, this textItem will format its value according to the rules described inFormItem.mapValueToDisplay()
as long as the item does not have focus. Once the user puts focus into the item the formatter will be removed. This provides a simple way for developers to show a nicely formatted display value in a freeform text field, without the need for an explicitFormItem.formatEditorValue()
andFormItem.parseEditorValue()
pair.- Returns:
- Current formatOnBlur value. Default value is false
-
setFormatOnFocusChange
ShouldFormItem.formatEditorValue()
re-run whenever this item recieves or loses focus? Setting this property allows developers to conditionally format the display value based on item.hasFocus, typically to display a longer, more informative string while the item does not have focus, and simplifying it down to an easier-to-edit string when the user puts focus into the item.- Parameters:
formatOnFocusChange
- New formatOnFocusChange value. Default value is false- Returns:
TextItem
instance, for chaining setter calls
-
getFormatOnFocusChange
ShouldFormItem.formatEditorValue()
re-run whenever this item recieves or loses focus? Setting this property allows developers to conditionally format the display value based on item.hasFocus, typically to display a longer, more informative string while the item does not have focus, and simplifying it down to an easier-to-edit string when the user puts focus into the item.- Returns:
- Current formatOnFocusChange value. Default value is false
-
setKeyPressFilter
Sets a keypress filter regular expression to limit valid characters that can be entered by the user. If defined, keys that match the regular expression are allowed; all others are suppressed. The filter is applied after character casing, if defined.Note: keypress filtering cannot be used at the same time as a
mask
.
If this method is called after the component has been drawn/initialized: Set thekeyPressFilter
for this itemNote : This is an advanced setting
- Parameters:
keyPressFilter
- new keyPress filter for the item. Default value is null- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getKeyPressFilter
Sets a keypress filter regular expression to limit valid characters that can be entered by the user. If defined, keys that match the regular expression are allowed; all others are suppressed. The filter is applied after character casing, if defined.Note: keypress filtering cannot be used at the same time as a
mask
.- Returns:
- Current keyPressFilter value. Default value is null
- See Also:
-
setLength
If set, the maximum number of characters for this field. IfenforceLength
is set to true, user input will be limited to this value, and values exceeding this length passed tosetValue()
will be trimmed. Otherwise values exceeding the specified length will raise an error on validation.If the item has a numeric type, like
integer
orfloat
, length is applied to the raw number value, after any specifieddecimalPrecision
anddecimalPad
but before any formatters - this means the string measured includes sign and decimal placeholder, and padded decimal places as required, but not thousands separators or any custom formatting.See also
DataSourceField.length
.- Parameters:
length
- New length value. Default value is null- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getLength
If set, the maximum number of characters for this field. IfenforceLength
is set to true, user input will be limited to this value, and values exceeding this length passed tosetValue()
will be trimmed. Otherwise values exceeding the specified length will raise an error on validation.If the item has a numeric type, like
integer
orfloat
, length is applied to the raw number value, after any specifieddecimalPrecision
anddecimalPad
but before any formatters - this means the string measured includes sign and decimal placeholder, and padded decimal places as required, but not thousands separators or any custom formatting.See also
DataSourceField.length
.- Returns:
- Current length value. Default value is null
- See Also:
-
setMask
Input mask used to restrict and format text within this item.Overview of available mask characters
Character Description 0 Digit (0 through 9) or plus [+] or minus [-] signs 9 Digit or space # Digit L Letter (A through Z) ? Letter (A through Z) or space A Letter or digit a Letter or digit C Any character or space < Causes all characters that follow to be converted to lowercase > Causes all characters that follow to be converted to uppercase [ ... ] Square brakets denote the start and end of a custom regular expression character set or range. The mask can also contain literals - arbitrary non editable characters to be displayed as part of the formatted text. Any character not matching one of the above mask characters will be considered a literal. To use one of the mask characters as a literal, it must be escaped with a pair of backslashes (\\). By default literals are formatting characters only and will not be saved as part of the item's value. This behavior is controlled via
maskSaveLiterals
.When a TextItem with a mask has focus, the formatted mask string will be displayed, with the
maskPromptChar
displayed as a placeholder for characters that have not yet been entered.
As the user types in the field, input will be restricted to the appropriate character class for each character, with uppercase/lowercase conversion occurring automatically. When focus is moved away from the field, the displayed value will be formatted to include any literals in the appropriate places.Sample masks:
- Phone number: (###) ###-####
- Social Security number: ###-##-####
- First name: >?<??????????
- Date: ##/##/####
- State: >LL
Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:
- Color: \\#>[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]
Note: input mask cannot be used at the same time as a
keyPressFilter
. Also note that this property is not supported forComboBoxItem
orSpinnerItem
, or for items withbrowserInputType
set to "digits" or "number".
If this method is called after the component has been drawn/initialized: Set themask
for this item. Pass null to clear an existing mask.Note that the current value of the field is cleared when changing the mask.
Note : This is an advanced setting
- Parameters:
mask
- mask to apply to text item. Default value is null- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getMask
Input mask used to restrict and format text within this item.Overview of available mask characters
Character Description 0 Digit (0 through 9) or plus [+] or minus [-] signs 9 Digit or space # Digit L Letter (A through Z) ? Letter (A through Z) or space A Letter or digit a Letter or digit C Any character or space < Causes all characters that follow to be converted to lowercase > Causes all characters that follow to be converted to uppercase [ ... ] Square brakets denote the start and end of a custom regular expression character set or range. The mask can also contain literals - arbitrary non editable characters to be displayed as part of the formatted text. Any character not matching one of the above mask characters will be considered a literal. To use one of the mask characters as a literal, it must be escaped with a pair of backslashes (\\). By default literals are formatting characters only and will not be saved as part of the item's value. This behavior is controlled via
maskSaveLiterals
.When a TextItem with a mask has focus, the formatted mask string will be displayed, with the
maskPromptChar
displayed as a placeholder for characters that have not yet been entered.
As the user types in the field, input will be restricted to the appropriate character class for each character, with uppercase/lowercase conversion occurring automatically. When focus is moved away from the field, the displayed value will be formatted to include any literals in the appropriate places.Sample masks:
- Phone number: (###) ###-####
- Social Security number: ###-##-####
- First name: >?<??????????
- Date: ##/##/####
- State: >LL
Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:
- Color: \\#>[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]
Note: input mask cannot be used at the same time as a
keyPressFilter
. Also note that this property is not supported forComboBoxItem
orSpinnerItem
, or for items withbrowserInputType
set to "digits" or "number".- Returns:
- Current mask value. Default value is null
- See Also:
-
setMaskOverwriteMode
During entry into amasked field
, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.Note : This is an advanced setting
- Parameters:
maskOverwriteMode
- New maskOverwriteMode value. Default value is null- Returns:
TextItem
instance, for chaining setter calls
-
getMaskOverwriteMode
During entry into amasked field
, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.- Returns:
- Current maskOverwriteMode value. Default value is null
-
setMaskPadChar
Character that is used to fill required emptymask
positions to display text while control has no focus.Note : This is an advanced setting
- Parameters:
maskPadChar
- New maskPadChar value. Default value is " "- Returns:
TextItem
instance, for chaining setter calls
-
getMaskPadChar
Character that is used to fill required emptymask
positions to display text while control has no focus.- Returns:
- Current maskPadChar value. Default value is " "
-
setMaskPromptChar
Character that is used to fill required emptymask
positions to display text while control has focus.Note : This is an advanced setting
- Parameters:
maskPromptChar
- New maskPromptChar value. Default value is "_"- Returns:
TextItem
instance, for chaining setter calls
-
getMaskPromptChar
Character that is used to fill required emptymask
positions to display text while control has focus.- Returns:
- Current maskPromptChar value. Default value is "_"
-
setMaskSaveLiterals
Should enteredmask
value be saved with embedded literals?Note : This is an advanced setting
- Parameters:
maskSaveLiterals
- New maskSaveLiterals value. Default value is null- Returns:
TextItem
instance, for chaining setter calls
-
getMaskSaveLiterals
Should enteredmask
value be saved with embedded literals?- Returns:
- Current maskSaveLiterals value. Default value is null
-
setPrintFullText
When generating a print-view of the component containing this TextItem, should the form item expand to accommodate its value? If set to false the text box will not expand to fit its content in the print view, instead showing exactly as it does in the live form. -
getPrintFullText
When generating a print-view of the component containing this TextItem, should the form item expand to accommodate its value? If set to false the text box will not expand to fit its content in the print view, instead showing exactly as it does in the live form.- Returns:
- Current printFullText value. Default value is false
- See Also:
-
setSaveOnEnter
Text items will submit their containing form on enter keypress ifsaveOnEnter
is true. Setting this property tofalse
will disable this behavior.- Overrides:
setSaveOnEnter
in classFormItem
- Parameters:
saveOnEnter
- New saveOnEnter value. Default value is true- Returns:
TextItem
instance, for chaining setter calls
-
getSaveOnEnter
Text items will submit their containing form on enter keypress ifsaveOnEnter
is true. Setting this property tofalse
will disable this behavior.- Overrides:
getSaveOnEnter
in classFormItem
- Returns:
- Current saveOnEnter value. Default value is true
-
setSelectOnClick
Allows theselectOnClick
behavior to be configured on a per-FormItem basis. Normally all items in a form default to the value ofDynamicForm.selectOnClick
.- Overrides:
setSelectOnClick
in classFormItem
- Parameters:
selectOnClick
- New selectOnClick value. Default value is null- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getSelectOnClick
Allows theselectOnClick
behavior to be configured on a per-FormItem basis. Normally all items in a form default to the value ofDynamicForm.selectOnClick
.- Overrides:
getSelectOnClick
in classFormItem
- Returns:
- Current selectOnClick value. Default value is null
- See Also:
-
setSelectOnFocus
Allows theselectOnFocus
behavior to be configured on a per-FormItem basis. Normally all items in a form default to the value ofDynamicForm.selectOnFocus
.- Overrides:
setSelectOnFocus
in classFormItem
- Parameters:
selectOnFocus
- New selectOnFocus value. Default value is null- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getSelectOnFocus
Allows theselectOnFocus
behavior to be configured on a per-FormItem basis. Normally all items in a form default to the value ofDynamicForm.selectOnFocus
.- Overrides:
getSelectOnFocus
in classFormItem
- Returns:
- Current selectOnFocus value. Default value is null
- See Also:
-
setShowHintInField
Ifshowing a hint for this form item
, should the hint be shown within the field?Unless the HTML5
placeholder
attribute is used to display the hint (seeusePlaceholderForHint
), the value of the <input> element for this item will be set to the hint whenever this item is not focused. Also, when displaying the hint, the CSS style of the data element will be set to thetextBoxStyle
with the suffix "Hint" appended to it; or, if the item is disabled, the suffix "DisabledHint" will be used. InRTL mode
whenshowRTL
istrue
, an additional "RTL" suffix will be appended; i.e. the CSS style of the data element when the hint is displayed will be thetextBoxStyle
plus "HintRTL" or "DisabledHintRTL".To change this attribute after being drawn, it is necessary to call
FormItem.redraw()
or redraw the form.Styling the in-field hint
The in-field hint can be styled with CSS for thetextBoxStyle
+ "Hint" / "HintRTL" / "DisabledHint" / "DisabledHintRTL" styles. For example, if this item'stextBoxStyle
is set to "mySpecialItem", then changing the hint color to blue can be accomplished with the following CSS:.mySpecialItemHint, .mySpecialItemHintRTL, .mySpecialItemDisabledHint, .mySpecialItemDisabledHintRTL { color: blue; }
In
DynamicForm.linearMode
, this property will be defaulted true if left unset.- Parameters:
showHintInField
- New showHintInField value. Default value is null- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getShowHintInField
Ifshowing a hint for this form item
, should the hint be shown within the field?Unless the HTML5
placeholder
attribute is used to display the hint (seeusePlaceholderForHint
), the value of the <input> element for this item will be set to the hint whenever this item is not focused. Also, when displaying the hint, the CSS style of the data element will be set to thetextBoxStyle
with the suffix "Hint" appended to it; or, if the item is disabled, the suffix "DisabledHint" will be used. InRTL mode
whenshowRTL
istrue
, an additional "RTL" suffix will be appended; i.e. the CSS style of the data element when the hint is displayed will be thetextBoxStyle
plus "HintRTL" or "DisabledHintRTL".To change this attribute after being drawn, it is necessary to call
FormItem.redraw()
or redraw the form.Styling the in-field hint
The in-field hint can be styled with CSS for thetextBoxStyle
+ "Hint" / "HintRTL" / "DisabledHint" / "DisabledHintRTL" styles. For example, if this item'stextBoxStyle
is set to "mySpecialItem", then changing the hint color to blue can be accomplished with the following CSS:.mySpecialItemHint, .mySpecialItemHintRTL, .mySpecialItemDisabledHint, .mySpecialItemDisabledHintRTL { color: blue; }
In
DynamicForm.linearMode
, this property will be defaulted true if left unset.- Returns:
- Current showHintInField value. Default value is null
- See Also:
-
setShowInputElement
When set to false, prevents this item's input element from being written into the DOM. If there arevalueIcons
or apicker icon
, these are displayed as normal, and the item will auto-sizing to that content if itswidth
is set to null.Note : This is an advanced setting
- Parameters:
showInputElement
- New showInputElement value. Default value is true- Returns:
TextItem
instance, for chaining setter calls
-
getShowInputElement
public boolean getShowInputElement()When set to false, prevents this item's input element from being written into the DOM. If there arevalueIcons
or apicker icon
, these are displayed as normal, and the item will auto-sizing to that content if itswidth
is set to null.- Returns:
- Current showInputElement value. Default value is true
-
setSupportsCutPasteEvents
Does the current formItem support native cut and paste events?This attribute only applies to freeform text entry fields such as
TextItem
andTextAreaItem
, and only ifchangeOnKeypress
is true. If true, developers can detect the user editing the value via cut or paste interactions (triggered from keyboard shortcuts or the native browser menu options) using theFormItem.isCutEvent()
andFormItem.isPasteEvent()
methods. This allows custom cut/paste handling to be added to the various change notification flow methods includingFormItem.change()
, andFormItem.transformInput()
.- Overrides:
setSupportsCutPasteEvents
in classFormItem
- Parameters:
supportsCutPasteEvents
- New supportsCutPasteEvents value. Default value is true- Returns:
TextItem
instance, for chaining setter calls
-
getSupportsCutPasteEvents
public boolean getSupportsCutPasteEvents()Does the current formItem support native cut and paste events?This attribute only applies to freeform text entry fields such as
TextItem
andTextAreaItem
, and only ifchangeOnKeypress
is true. If true, developers can detect the user editing the value via cut or paste interactions (triggered from keyboard shortcuts or the native browser menu options) using theFormItem.isCutEvent()
andFormItem.isPasteEvent()
methods. This allows custom cut/paste handling to be added to the various change notification flow methods includingFormItem.change()
, andFormItem.transformInput()
.- Overrides:
getSupportsCutPasteEvents
in classFormItem
- Returns:
- Current supportsCutPasteEvents value. Default value is true
-
setSuppressBrowserClearIcon
This attribute currently only has an effect in Internet Explorer. That browser will dynamically add a native "clear" icon to <input type="text" > elements when the user enters a value. SettingsuppressBrowserClearIcon
totrue
will write out HTML to suppress this icon. This can be particularly useful for items which define their own clear icon as in this sample.If this property is not set at the item level,
DynamicForm.suppressBrowserClearIcons
will be used instead.Note that as an alternative to using this feature, the icon may also be suppressed (or have other styling applied to it) directly via CSS, using the
::-ms-clear
css pseudo-element (proprietary Internet Explorer feature).Implementation note: This feature makes use of the automatically generated
suppressClearIconClassName
css class.
If this method is called after the component has been drawn/initialized: Setter for thesuppressBrowserClearIcon
- Parameters:
suppressBrowserClearIcon
- new value for suppressBrowserClearIcon. Default value is null- Returns:
TextItem
instance, for chaining setter calls
-
getSuppressBrowserClearIcon
This attribute currently only has an effect in Internet Explorer. That browser will dynamically add a native "clear" icon to <input type="text" > elements when the user enters a value. SettingsuppressBrowserClearIcon
totrue
will write out HTML to suppress this icon. This can be particularly useful for items which define their own clear icon as in this sample.If this property is not set at the item level,
DynamicForm.suppressBrowserClearIcons
will be used instead.Note that as an alternative to using this feature, the icon may also be suppressed (or have other styling applied to it) directly via CSS, using the
::-ms-clear
css pseudo-element (proprietary Internet Explorer feature).Implementation note: This feature makes use of the automatically generated
suppressClearIconClassName
css class.- Returns:
- Current suppressBrowserClearIcon value. Default value is null
-
setTextBoxStyle
Base CSS class name for this item's input element. NOTE: See theCompoundFormItem_skinning
discussion for special skinning considerations.For a rounded text item, you can set
textBoxStyle
to "roundedTextItem". This style exists only in Enterprise, EnterpriseBlue and Graphite skins. There is no corresponding rounded style for SelectItem or ComboBoxItem as this creates an awkward seam with the pop-up list (and a rounded pop-up list wouldn't help: data could not be flush to corners). For these reasons we recommend rounded inputs only in limited cases like single standalone fields.- Overrides:
setTextBoxStyle
in classFormItem
- Parameters:
textBoxStyle
- New textBoxStyle value. Default value is "textItem"- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getTextBoxStyle
Base CSS class name for this item's input element. NOTE: See theCompoundFormItem_skinning
discussion for special skinning considerations.For a rounded text item, you can set
textBoxStyle
to "roundedTextItem". This style exists only in Enterprise, EnterpriseBlue and Graphite skins. There is no corresponding rounded style for SelectItem or ComboBoxItem as this creates an awkward seam with the pop-up list (and a rounded pop-up list wouldn't help: data could not be flush to corners). For these reasons we recommend rounded inputs only in limited cases like single standalone fields.- Overrides:
getTextBoxStyle
in classFormItem
- Returns:
- Current textBoxStyle value. Default value is "textItem"
- See Also:
-
setUsePlaceholderForHint
Ifshowing the hint in field
and if supported by the browser, should the HTML5placeholder
attribute be used to display the hint within the field? If set tofalse
, then use of theplaceholder
attribute is disabled and an alternative technique to display the hint in-field is used instead.The HTML5
placeholder
attribute is supported in the following major browsers:- Chrome 4+
- Firefox 4+
- Internet Explorer 10+
- Safari 5+
- Opera 11.50+
- Android 2.1+
WebView
(used by the stock Browser app and whenpackaging with PhoneGap
) - Mobile Safari for iOS 3.2+
In browsers other than the above, in-field hints are implemented via a different technique.
Note that placeholder behavior is known to differ in Internet Explorer and certain old versions of the above browsers due to a recent change in the HTML5 specification regarding the
placeholder
attribute. Under the old rules, the placeholder is cleared when the element is focused. In the latest HTML5 spec as published by WHATWG, the placeholder is still displayed when the element is focused as long as the value is an empty string.Styling the placeholder
While there isn't a standard way to style the placeholder text, Chrome, Firefox, Internet Explorer, and Safari provide vendor-prefixed pseudo-classes and/or pseudo-elements that can be used in CSS selectors:Browser Pseudo-class or pseudo-element Chrome, Safari ::-webkit-input-placeholder
Firefox 4 - 18 :-moz-placeholder
Firefox 19+ ::-moz-placeholder
Internet Explorer :-ms-input-placeholder
Note that unlike other browsers, Firefox 19+ applies opacity:0.4 to the placeholder text. See Bug 556145 - Placeholder text default style should use opacity instead of GrayText
Because browsers are required to ignore the entire rule if a selector is invalid, separate rules are needed for each browser. For example:
::-webkit-input-placeholder { color: blue; opacity: 1; } :-moz-placeholder { color: blue; opacity: 1; } ::-moz-placeholder { color: blue; opacity: 1; } :-ms-input-placeholder { color: blue; opacity: 1; }
If using Sass, it may be useful to utilize Sass' parent selector feature. For example:
.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... &::-webkit-input-placeholder { color: blue; opacity: 1; } &:-moz-placeholder { color: blue; opacity: 1; } &::-moz-placeholder { color: blue; opacity: 1; } &:-ms-input-placeholder { color: blue; opacity: 1; } }
If using Compass, the
input-placeholder
mixin that was added in version 1.0 can further simplify the code to style the placeholder text For example:.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... @include input-placeholder { color: blue; opacity: 1; } }
Accessibility concerns
The HTML5 specification notes that a placeholder should not be used as a replacement for a title. The placeholder is intended to be a short hint that assists the user who is entering a value into the empty field. The placeholder can be mistaken by some users for a pre-filled value, particularly in Internet Explorer because the same color is used, and the placeholder text color may provide insufficient contrast, particularly in Firefox 19+ because of the default 0.4 opacity. Furthermore, not having a title reduces the hit area available for setting focus on the item.Note : This is an advanced setting
- Parameters:
usePlaceholderForHint
- New usePlaceholderForHint value. Default value is true- Returns:
TextItem
instance, for chaining setter calls- See Also:
-
getUsePlaceholderForHint
public boolean getUsePlaceholderForHint()Ifshowing the hint in field
and if supported by the browser, should the HTML5placeholder
attribute be used to display the hint within the field? If set tofalse
, then use of theplaceholder
attribute is disabled and an alternative technique to display the hint in-field is used instead.The HTML5
placeholder
attribute is supported in the following major browsers:- Chrome 4+
- Firefox 4+
- Internet Explorer 10+
- Safari 5+
- Opera 11.50+
- Android 2.1+
WebView
(used by the stock Browser app and whenpackaging with PhoneGap
) - Mobile Safari for iOS 3.2+
In browsers other than the above, in-field hints are implemented via a different technique.
Note that placeholder behavior is known to differ in Internet Explorer and certain old versions of the above browsers due to a recent change in the HTML5 specification regarding the
placeholder
attribute. Under the old rules, the placeholder is cleared when the element is focused. In the latest HTML5 spec as published by WHATWG, the placeholder is still displayed when the element is focused as long as the value is an empty string.Styling the placeholder
While there isn't a standard way to style the placeholder text, Chrome, Firefox, Internet Explorer, and Safari provide vendor-prefixed pseudo-classes and/or pseudo-elements that can be used in CSS selectors:Browser Pseudo-class or pseudo-element Chrome, Safari ::-webkit-input-placeholder
Firefox 4 - 18 :-moz-placeholder
Firefox 19+ ::-moz-placeholder
Internet Explorer :-ms-input-placeholder
Note that unlike other browsers, Firefox 19+ applies opacity:0.4 to the placeholder text. See Bug 556145 - Placeholder text default style should use opacity instead of GrayText
Because browsers are required to ignore the entire rule if a selector is invalid, separate rules are needed for each browser. For example:
::-webkit-input-placeholder { color: blue; opacity: 1; } :-moz-placeholder { color: blue; opacity: 1; } ::-moz-placeholder { color: blue; opacity: 1; } :-ms-input-placeholder { color: blue; opacity: 1; }
If using Sass, it may be useful to utilize Sass' parent selector feature. For example:
.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... &::-webkit-input-placeholder { color: blue; opacity: 1; } &:-moz-placeholder { color: blue; opacity: 1; } &::-moz-placeholder { color: blue; opacity: 1; } &:-ms-input-placeholder { color: blue; opacity: 1; } }
If using Compass, the
input-placeholder
mixin that was added in version 1.0 can further simplify the code to style the placeholder text For example:.myCustomItem, .myCustomItemRTL, .myCustomItemDisabled, .myCustomItemDisabledRTL, .myCustomItemError, .myCustomItemErrorRTL, .myCustomItemFocused, .myCustomItemFocusedRTL, .myCustomItemHint, .myCustomItemHintRTL, .myCustomItemDisabledHint, .myCustomItemDisabledHintRTL { // ... @include input-placeholder { color: blue; opacity: 1; } }
Accessibility concerns
The HTML5 specification notes that a placeholder should not be used as a replacement for a title. The placeholder is intended to be a short hint that assists the user who is entering a value into the empty field. The placeholder can be mistaken by some users for a pre-filled value, particularly in Internet Explorer because the same color is used, and the placeholder text color may provide insufficient contrast, particularly in Firefox 19+ because of the default 0.4 opacity. Furthermore, not having a title reduces the hit area available for setting focus on the item.- Returns:
- Current usePlaceholderForHint value. Default value is true
- See Also:
-
deselectValue
public void deselectValue()If this item currently has focus, clear the current selection. leaving focus in the item. Has no effect if the item is undrawn or unfocused. Only applies to text-based items. -
deselectValue
If this item currently has focus, clear the current selection. leaving focus in the item. Has no effect if the item is undrawn or unfocused. Only applies to text-based items.- Parameters:
start
- By default the text insertion cursor will be moved to the end of the current value - pass in this parameter to move to the start instead
-
getEnteredValue
Returns the raw text value that currently appears in the text field, which can differ fromFormItem.getValue()
in various cases - for example:- for items that constrain the value range, such as a
DateItem
withenforceDate
:true, or aComboBoxItem
withaddUnknownValues
:false - for items with a defined valueMap or edit value formatter and parser functions which converts display value to data value
- while the item has focus if
changeOnKeypress
is false
- Returns:
- current entered value
- for items that constrain the value range, such as a
-
getHint
Returns the hint text for this item. Default implementation returnsFormItem.hint
, or null if there is no hint to show.- Overrides:
getHint
in classFormItem
- Returns:
- HTML to show as the hint for the item.
See
HTMLString
- See Also:
-
getSelectionRange
public int[] getSelectionRange()For text-based items, this method returns the indices of the start/end of the current selection if the item currently has the focus. In browsers other than Internet Explorer 6-9, if this item does not have focus, then this method returns the indices of the start/end of the selection the last time that this item had focus. In IE 6-9, returns null if the item does not have focus.In all browsers, clicking anywhere outside of the item causes the item to lose focus; hence, in IE 6-9, this method will not work in other components' event handlers for certain events. For example, within the
click()
handler of a button, this item will have already lost focus, so in IE 6-9, this method will return null if called within the button's click() handler. One cross-browser solution to this issue is to save the selection range for later in amouseDown()
ormouseOver()
handler.Notes:
- In browsers other
than IE 6-9, calling
setValue()
or otherwise changing theentered value
invalidates the past selection range. - The returned indices are indices within the entered value rather than the item's value as
returned by
getValue()
. The distinction is particularly important forTextAreaItem
s because browsers normalize the line endings in the<textarea>
element's value. Internet Explorer 6, 7, and 8 convert line endings to "\r\n" while other browsers convert line endings to "\n" as specified by the HTML5 standard.
- Returns:
- 2 element array showing character index of the current or past selection's start and end points within this item's
entered value
. In IE 6-9, returns null if the item does not have focus.
- In browsers other
than IE 6-9, calling
-
pendingStatusChanged
public boolean pendingStatusChanged(DynamicForm form, FormItem item, boolean pendingStatus, Object newValue, Object value) Notification method called whenshowPending
is enabled and this text item should either clear or show its pending visual state.The default behavior is that the
titleStyle
,cellStyle
, andtextBoxStyle
are updated to include/exclude the "Pending" suffix. Returningfalse
will cancel this default behavior.- Parameters:
form
- the managingDynamicForm
instance.item
- the form item itself (also available as "this").pendingStatus
-true
if the item should show its pending visual state;false
otherwise.newValue
- the current form item value.value
- the value that would be restored by a call toDynamicForm.resetValues()
.- Returns:
false
to cancel the default behavior.
-
selectValue
public void selectValue()Put focus in this item and select the entire value. Only applies to text based items -
setSelectionRange
public void setSelectionRange(int start, int end) Puts focus into this form item and selects characters between the given indices. Only applies to drawn text based items.- Parameters:
start
- selection starting character indexend
- end of selection character index
-
shouldFetchMissingValue
If this field has a specifiedoptionDataSource
, should we perform a fetch against that dataSource to find the record that matches this field's value?For textItems this method will return false if the item is
editable
unlessFormItem.alwaysFetchMissingValues
is true, even if there is a specifieddisplayField
. We do this as, for a freeform text-entry field with a specified displayField, the correct behavior when the user enters an unrecognized value is somewhat ambiguous. The user could have entered a complete display-field value, in which case it might be appropriate to issue a fetch against the display-field of the optionDataSource, and set the underlying item value.
If a match was not found though, we necessarily treat the entered value as the new "dataValue" for the field. Should we then issue a second fetch against the optionDataSource comparing the user-entered value with the value-field of the dataSource?There are still cases where it could make sense to issue the fetch against the dataSource, and developers who want this behavior can set
alwaysFetchMissingValues
to true.See
FormItem.shouldFetchMissingValue()
for how this method behaves for other item types.- Overrides:
shouldFetchMissingValue
in classFormItem
- Parameters:
newValue
- The new data value of the item.- Returns:
- should we fetch the record matching the new value from the item's optionDataSource?
-
setPastedValueTransformer
Notification fired in response to a clipboard "paste" event on freeform text items, giving developers an opportunity to reformat the pasted text. ThepastedValue
argument contains the text pasted from the clipboard. This method should return the text value to actually insert into the input element.- Parameters:
PastedValueTransformer
- customizer
-
setDefaultProperties
Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties of the class instance passed to this function. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.
- Parameters:
textItemProperties
- properties that should be used as new defaults when instances of this class are created- See Also:
-
getValueAsString
Return the value tracked by this form item.- Returns:
- value of this element
-