public class TextItem extends FormItem
FormItem.CustomStateGetter, FormItem.StateCustomizer
scClassName, warnOnEditorTypeConversion, warnOnEditorTypeConversionDefault
id
factoryCreated, factoryProperties, readOnly
Constructor and Description |
---|
TextItem() |
TextItem(com.google.gwt.core.client.JavaScriptObject jsObj) |
TextItem(java.lang.String name) |
TextItem(java.lang.String name,
java.lang.String title) |
Modifier and Type | Method and Description |
---|---|
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
Canvas defaults)
Changes the defaults for Canvas AutoChildren named
autoChildName . |
static void |
changeAutoChildDefaults(java.lang.String autoChildName,
FormItem defaults)
Changes the defaults for FormItem AutoChildren named
autoChildName . |
static void |
changePickerIconDefaults(FormItemIcon defaults) |
void |
deselectValue()
If this item currently has focus, clear the current selection.
|
void |
deselectValue(java.lang.Boolean start)
If this item currently has focus, clear the current selection.
|
java.lang.Boolean |
getBrowserAutoCapitalize() |
java.lang.Boolean |
getBrowserAutoCorrect()
In Mobile Safari, should automatic correction be offered for text in the item's text box? If
null , then
Mobile Safari determines automatically whether to enable autocorrect. |
java.lang.String |
getBrowserInputType()
This property corresponds to the HTML5 "inputType" attribute applied to the <input> element for this TextItem.
|
java.lang.Boolean |
getChangeOnKeypress()
Should this form item fire its
change handler
(and store its value in the form) on every keypress? Set to false to suppress the 'change' handler firing
(and the value stored) on every keypress. |
CharacterCasing |
getCharacterCasing()
Should entered characters be converted to upper or lowercase? Also applies to values applied with
FormItem.setValue() . |
java.lang.String |
getEditProxyConstructor()
Default class used to construct the
EditProxy for this component when the component is
first placed into edit mode . |
boolean |
getEnforceLength()
If a
length is specified for this item, should user
input be limited to the specified length? If set to true, user input and values passed to setValue() will be trimmed to the specified length. |
java.lang.String |
getEnteredValue()
Returns the raw text value that currently appears in the text field, which can differ from
FormItem.getValue() in various cases - for example:
for items that constrain the value range, such as a DateItem with
enforceDate :true, or a ComboBoxItem with addUnknownValues :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 |
java.lang.Boolean |
getEscapeHTML()
By default HTML characters will be escaped when
canEdit is false and readOnlyDisplay 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" ). |
java.lang.Boolean |
getFetchMissingValues()
If this form item has a specified
FormItem.optionDataSource , should the item ever perform a fetch against this dataSource to retrieve the related record. |
java.lang.Boolean |
getFormatOnBlur()
With
formatOnBlur enabled, this textItem will format its value according to the rules described in FormItem.mapValueToDisplay() as long as the item
does not have focus. |
java.lang.Boolean |
getFormatOnFocusChange()
Should
FormItem.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. |
java.lang.String |
getHint()
Returns the hint text for this item.
|
java.lang.String |
getKeyPressFilter()
Sets a keypress filter regular expression to limit valid characters that can be entered by the user.
|
java.lang.Integer |
getLength()
If set, maximum number of characters for this field.
|
java.lang.String |
getMask()
Input mask used to filter text entry.
|
java.lang.Boolean |
getMaskOverwriteMode()
During entry into masked field, should keystrokes overwrite current position value? By default new keystrokes are
inserted into the field.
|
java.lang.String |
getMaskPadChar()
Character that is used to fill required empty mask positions to display text while control has no focus.
|
java.lang.String |
getMaskPromptChar()
Character that is used to fill required empty mask positions to display text while control has focus.
|
java.lang.Boolean |
getMaskSaveLiterals()
Should entered mask value be saved with embedded literals?
|
static TextItem |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
java.lang.Boolean |
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.
|
java.lang.Boolean |
getSaveOnEnter()
Text items will submit their containing form on enter keypress if
saveOnEnter is true. |
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.
|
java.lang.Boolean |
getSelectOnClick()
Allows the
selectOnClick behavior to be configured
on a per-FormItem basis. |
java.lang.Boolean |
getSelectOnFocus()
Allows the
selectOnFocus behavior to be configured
on a per-FormItem basis. |
java.lang.Boolean |
getShowHintInField()
If
showing a hint for this form item , should the
hint be shown within the field? |
boolean |
getSupportsCutPasteEvents()
Does the current formItem support native cut and paste events?
|
java.lang.String |
getTextBoxStyle()
Base CSS class name for this item's input element.
|
boolean |
getUsePlaceholderForHint()
If
showing the hint in field and if
supported by the browser, should the HTML5
placeholder attribute
be used to display the hint within the field? If set to false , then use of
the placeholder attribute is disabled and an alternative technique to display
the hint in-field is used instead. |
java.lang.String |
getValueAsString()
Return the value tracked by this form item.
|
boolean |
pendingStatusChanged(DynamicForm form,
FormItem item,
boolean pendingStatus,
java.lang.Object newValue,
java.lang.Object value)
Notification method called when
showPending is
enabled and this text item should either clear or show its pending visual state. |
void |
selectValue()
Put focus in this item and select the entire value.
|
void |
setBrowserAutoCapitalize(java.lang.Boolean browserAutoCapitalize)
Note : This is an advanced setting
|
void |
setBrowserAutoCorrect(java.lang.Boolean browserAutoCorrect)
In Mobile Safari, should automatic correction be offered for text in the item's text box? If
null , then
Mobile Safari determines automatically whether to enable autocorrect. |
void |
setBrowserInputType(java.lang.String browserInputType)
This property corresponds to the HTML5 "inputType" attribute applied to the <input> element for this TextItem.
|
void |
setChangeOnKeypress(java.lang.Boolean changeOnKeypress)
Should this form item fire its
change handler
(and store its value in the form) on every keypress? Set to false to suppress the 'change' handler firing
(and the value stored) on every keypress. |
void |
setCharacterCasing(CharacterCasing characterCasing)
Should entered characters be converted to upper or lowercase? Also applies to values applied with
FormItem.setValue() . |
static void |
setDefaultProperties(TextItem textItemProperties)
Class level method to set the default properties of this class.
|
void |
setEditProxyConstructor(java.lang.String editProxyConstructor)
Default class used to construct the
EditProxy for this component when the component is
first placed into edit mode . |
void |
setEnforceLength(boolean enforceLength)
If a
length is specified for this item, should user
input be limited to the specified length? If set to true, user input and values passed to setValue() will be trimmed to the specified length. |
void |
setEscapeHTML(java.lang.Boolean escapeHTML)
By default HTML characters will be escaped when
canEdit is false and readOnlyDisplay 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" ). |
void |
setFetchMissingValues(java.lang.Boolean fetchMissingValues)
If this form item has a specified
FormItem.optionDataSource , should the item ever perform a fetch against this dataSource to retrieve the related record. |
void |
setFormatOnBlur(java.lang.Boolean formatOnBlur)
With
formatOnBlur enabled, this textItem will format its value according to the rules described in FormItem.mapValueToDisplay() as long as the item
does not have focus. |
void |
setFormatOnFocusChange(java.lang.Boolean formatOnFocusChange)
Should
FormItem.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. |
void |
setKeyPressFilter(java.lang.String keyPressFilter)
Sets a keypress filter regular expression to limit valid characters that can be entered by the user.
|
void |
setLength(java.lang.Integer length)
If set, maximum number of characters for this field.
|
void |
setMask(java.lang.String mask)
Input mask used to filter text entry.
|
void |
setMaskOverwriteMode(java.lang.Boolean maskOverwriteMode)
During entry into masked field, should keystrokes overwrite current position value? By default new keystrokes are
inserted into the field.
|
void |
setMaskPadChar(java.lang.String maskPadChar)
Character that is used to fill required empty mask positions to display text while control has no focus.
|
void |
setMaskPromptChar(java.lang.String maskPromptChar)
Character that is used to fill required empty mask positions to display text while control has focus.
|
void |
setMaskSaveLiterals(java.lang.Boolean maskSaveLiterals)
Should entered mask 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.
|
void |
setPrintFullText(java.lang.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.
|
void |
setSaveOnEnter(java.lang.Boolean saveOnEnter)
Text items will submit their containing form on enter keypress if
saveOnEnter is true. |
void |
setSelectionRange(int start,
int end)
Puts focus into this form item and selects characters between the given indices.
|
void |
setSelectOnClick(java.lang.Boolean selectOnClick)
Allows the
selectOnClick behavior to be configured
on a per-FormItem basis. |
void |
setSelectOnFocus(java.lang.Boolean selectOnFocus)
Allows the
selectOnFocus behavior to be configured
on a per-FormItem basis. |
void |
setShowHintInField(java.lang.Boolean showHintInField)
If
showing a hint for this form item , should the
hint be shown within the field? |
void |
setSupportsCutPasteEvents(boolean supportsCutPasteEvents)
Does the current formItem support native cut and paste events?
|
void |
setTextBoxStyle(java.lang.String textBoxStyle)
Base CSS class name for this item's input element.
|
void |
setUsePlaceholderForHint(boolean usePlaceholderForHint)
If
showing the hint in field and if
supported by the browser, should the HTML5
placeholder attribute
be used to display the hint within the field? If set to false , then use of
the placeholder attribute is disabled and an alternative technique to display
the hint in-field is used instead. |
java.lang.Boolean |
shouldFetchMissingValue(java.lang.Object newValue)
If this field has a specified
optionDataSource , should we perform a fetch against that dataSource to find the record that matches this field's value? |
_getValue, addBlurHandler, addChangedHandler, addChangeHandler, addClickHandler, addDoubleClickHandler, addEditorEnterHandler, addEditorExitHandler, addFocusHandler, addIconClickHandler, addIconKeyPressHandler, addItemHoverHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addPendingStatusChangedHandler, addPickerIconClickHandler, addShowContextMenuHandler, addTitleClickHandler, addTitleDoubleClickHandler, addTitleHoverHandler, addValueHoverHandler, addValueIconClickHandler, applyFormula, asSGWTComponent, blurItem, canEditCriterion, clearErrors, clearValue, disable, disableIcon, enable, enableIcon, error, error, errorIfNotCreated, focusInItem, getAccessKey, getAlign, getAllowExpressions, getAlwaysFetchMissingValues, getApplyAlignToText, getApplyHeightToTextBox, getAriaRole, getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsObject, getAttributeAsString, getAutoComplete, getBrowserSpellCheck, getCanEdit, getCanEditOpaqueValues, getCanFocus, getCanSelectText, getCanTabToIcons, getCanvasAutoChild, getCellHeight, getCellStyle, getClassName, getClipStaticValue, getClipTitle, getConfig, getContainerWidget, getControlStyle, getCriteriaField, getCriterion, getCriterion, getCursorPosition, getCustomState, getDataPath, getDateFormatter, getDecimalPad, getDecimalPrecision, getDefaultIconSrc, getDisabled, getDisableIconsOnReadOnly, getDisplayField, getDisplayFieldName, getDisplayValue, getDisplayValue, getEditorTypeConfig, getEditPendingCSSText, getEmptyDisplayValue, getEmptyValueIcon, getEndRow, getErrorIconHeight, getErrorIconSrc, getErrorIconWidth, getErrorMessageWidth, getErrors, getExportFormat, getFieldName, getFilterLocally, getForeignDisplayField, getForm, getFormat, getFormItemAutoChild, getFormula, getFullDataPath, getGlobalTabIndex, getGridColNum, getGridRowNum, getHeight, getHeightAsString, getHidden, getHintStyle, getHoverAlign, getHoverDelay, getHoverHeight, getHoverOpacity, getHoverStyle, getHoverVAlign, getHoverWidth, getIcon, getIconHeight, getIconHSpace, getIconPageRect, getIconPrompt, getIconRect, getIconVAlign, getIconWidth, getImageURLPrefix, getImageURLSuffix, getImplicitSave, getImplicitSaveOnBlur, getInputFormat, getLeft, getLoadingDisplayValue, getLocateItemBy, getMinHintWidth, getMultipleValueSeparator, getName, getOperator, getOptionCriteria, getOptionDataSource, getOptionDataSourceAsString, getOptionFilterContext, getOptionOperationId, getOriginalValueMessage, getPageLeft, getPageRect, getPageTop, getPicker, getPickerIconHeight, getPickerIconName, getPickerIconPrompt, getPickerIconProperties, getPickerIconSrc, getPickerIconStyle, getPickerIconWidth, getPixelHeight, getPixelWidth, getPrintTextBoxStyle, getPrintTitleStyle, getPrompt, getReadOnlyDisplay, getReadOnlyHover, getReadOnlyTextBoxStyle, getReadOnlyWhen, getRect, getRedrawOnChange, getRejectInvalidValueOnChange, getRequired, getRequiredMessage, getRequiredWhen, getRowSpan, getScClassName, getSelectedRecord, getShouldSaveValue, getShowClippedTitleOnHover, getShowClippedValueOnHover, getShowDeletions, getShowDisabled, getShowErrorIcon, getShowErrorStyle, getShowErrorText, getShowFocused, getShowFocusedErrorState, getShowFocusedIcons, getShowFocusedPickerIcon, getShowHint, getShowIcons, getShowOldValueInHover, getShowOver, getShowOverIcons, getShowPending, getShowPickerIcon, getShowRTL, getShowTitle, getShowValueIconOnly, getStartRow, getStaticHeight, getStopOnError, getSuppressValueIcon, getSynchronousValidation, getTabIndex, getTextAlign, getTextFormula, getTimeFormatter, getTitle, getTitleAlign, getTitleColSpan, getTitleOrientation, getTitleStyle, getTitleVAlign, getTooltip, getTop, getType, getUpdateControlOnOver, getUpdatePickerIconOnOver, getUpdateTextBoxOnOver, getUseDisabledHintStyleForReadOnly, getValidateOnChange, getValidateOnExit, getValidOperators, getVAlign, getValue, getValueAsRecordList, getValueDeselectedCSSText, getValueField, getValueFieldName, getValueIconHeight, getValueIconLeftPadding, getValueIconRightPadding, getValueIconSize, getValueIconWidth, getVisible, getVisibleHeight, getVisibleTitleWidth, getVisibleWhen, getVisibleWidth, getWarnOnEditorTypeConversion, getWarnOnEditorTypeConversionDefault, getWidth, getWidthAsString, getWrapHintText, getWrapTitle, handleWarnOnEditorTypeConversion, hasAdvancedCriteria, hasErrors, hide, hideIcon, invalidateDisplayValueCache, isCreated, isCutEvent, isDisabled, isDrawn, isFocused, isInGrid, isPasteEvent, isVisible, linkToInstanceUponCreate, mapDisplayToValue, mapValueToDisplay, mapValueToDisplay, mapValueToDisplay, redraw, redraw, setAccessKey, setAlign, setAllowExpressions, setAlwaysFetchMissingValues, 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, setBrowserSpellCheck, setCanEdit, setCanEditCriterionPredicate, setCanEditOpaqueValues, setCanFocus, setCanSelectText, setCanTabToIcons, setCellHeight, setCellStyle, setClipStaticValue, setClipTitle, setColSpan, setColSpan, setControlStyle, setCriteriaField, setCriterion, setCriterionGetter, setCriterionSetter, setCustomStateGetter, setDataPath, setDateFormatter, setDecimalPad, setDecimalPrecision, setDefaultIconSrc, setDefaultProperties, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDisabled, setDisableIconsOnReadOnly, setDisplayField, setDisplayFormat, setDisplayFormat, setEditorProperties, setEditorType, setEditorType, setEditorType, setEditorValueFormatter, setEditorValueParser, setEditPendingCSSText, setEmptyDisplayValue, setEmptyValueIcon, setEndRow, setErrorFormatter, setErrorIconHeight, setErrorIconSrc, setErrorIconWidth, setErrorMessageWidth, setErrorOrientation, setErrors, setErrors, setExportFormat, setFilterLocally, setForeignDisplayField, setFormat, setFormula, setGlobalTabIndex, setHeight, setHeight, setHidden, setHint, setHintStyle, setHoverAlign, setHoverDelay, setHoverHeight, setHoverOpacity, setHoverStyle, setHoverVAlign, setHoverWidth, setIconDisabled, setIconHeight, setIconHSpace, setIconPrompt, setIcons, setIconVAlign, setIconWidth, setImageURLPrefix, setImageURLSuffix, setImplicitSave, setImplicitSaveOnBlur, setInitHandler, setInputFormat, setInputTransformer, setItemHoverFormatter, setItemTitleHoverFormatter, setItemValueHoverFormatter, setJavaScriptObject, setLeft, setLoadingDisplayValue, setLocateItemBy, setMinHintWidth, setMultipleValueSeparator, setName, setNullProperty, setOperator, setOptionCriteria, setOptionDataSource, setOptionDataSource, setOptionFilterContext, setOptionOperationId, setOriginalValueMessage, setPickerIconHeight, setPickerIconName, setPickerIconPrompt, setPickerIconProperties, setPickerIconSrc, setPickerIconStyle, setPickerIconWidth, setPrintTextBoxStyle, setPrintTitleStyle, setPrompt, setProperty, setProperty, setProperty, setProperty, setProperty, setReadOnlyDisplay, setReadOnlyHover, setReadOnlyTextBoxStyle, setReadOnlyWhen, setRedrawOnChange, setRejectInvalidValueOnChange, setRequired, setRequiredMessage, setRequiredWhen, setRowSpan, setScClassName, setShouldSaveValue, setShowClippedTitleOnHover, setShowClippedValueOnHover, setShowDeletions, setShowDisabled, setShowErrorIcon, setShowErrorStyle, setShowErrorText, setShowFocused, setShowFocusedErrorState, setShowFocusedIcons, setShowFocusedPickerIcon, setShowHint, setShowIcons, setShowIfCondition, setShowOldValueInHover, setShowOver, setShowOverIcons, setShowPending, setShowPickerIcon, setShowRTL, setShowTitle, setShowValueIconOnly, setStartRow, setStateCustomizer, setStaticHeight, setStopOnError, setSuppressValueIcon, setSynchronousValidation, setTabIndex, setTextAlign, setTextFormula, setTimeFormatter, setTitle, setTitleAlign, setTitleColSpan, setTitleHoverFormatter, setTitleOrientation, setTitleStyle, setTitleVAlign, setTooltip, setTop, setType, setUpdateControlOnOver, setUpdatePickerIconOnOver, setUpdateTextBoxOnOver, setUseDisabledHintStyleForReadOnly, 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, setWrapTitle, shouldApplyHeightToTextBox, shouldSaveOnEnter, shouldStopKeyPressBubbling, show, showIcon, showPicker, stopHover, storeValue, storeValue, updateState, validate, valueClipped
getRef, getRef, internalSetID
applyFactoryProperties, doAddHandler, fireEvent, getAttributeAsDoubleArray, getAttributeAsIntArray, getAttributeAsLong, getAttributeAsMap, getAttributeAsObject, getAttributeAsRecord, getAttributeAsStringArray, getAttributes, getHandlerCount, getReadOnly, isFactoryCreated, logConfiguration, setAttribute, setAttribute, setAttribute, setAttributeAsJavaObject, setFactoryCreated, setReadOnly
public TextItem()
public TextItem(com.google.gwt.core.client.JavaScriptObject jsObj)
public TextItem(java.lang.String name)
public TextItem(java.lang.String name, java.lang.String title)
public static TextItem getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public static void changeAutoChildDefaults(java.lang.String autoChildName, Canvas defaults)
autoChildName
.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, see SGWTProperties
.AutoChildUsage
public static void changeAutoChildDefaults(java.lang.String autoChildName, FormItem defaults)
autoChildName
.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, see SGWTProperties
.AutoChildUsage
public static void changePickerIconDefaults(FormItemIcon defaults)
public void setBrowserAutoCapitalize(java.lang.Boolean browserAutoCapitalize)
Note : This is an advanced setting
browserAutoCapitalize
- Default value is nullpublic java.lang.Boolean getBrowserAutoCapitalize()
public void setBrowserAutoCorrect(java.lang.Boolean browserAutoCorrect)
null
, 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
browserAutoCorrect
- Default value is nullpublic java.lang.Boolean getBrowserAutoCorrect()
null
, then
Mobile Safari determines automatically whether to enable autocorrect. When enabled, Mobile Safari displays
"autocorrect bubbles" to suggest automatic corrections:
public void setBrowserInputType(java.lang.String browserInputType)
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 value | If a browser supports another input type. |
Note : This is an advanced setting
setBrowserInputType
in class FormItem
browserInputType
- Default value is nullpublic java.lang.String getBrowserInputType()
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 value | If a browser supports another input type. |
getBrowserInputType
in class FormItem
public void setChangeOnKeypress(java.lang.Boolean changeOnKeypress)
change
handler
(and store its value in the form) on every keypress? Set to false
to suppress the 'change' handler firing
(and the value stored) on every keypress. Note: If false
, the value returned by getValue
will not reflect the value displayed in the form
item element as long as focus is in the form item element.
setChangeOnKeypress
in class FormItem
changeOnKeypress
- Default value is truepublic java.lang.Boolean getChangeOnKeypress()
change
handler
(and store its value in the form) on every keypress? Set to false
to suppress the 'change' handler firing
(and the value stored) on every keypress. Note: If false
, the value returned by getValue
will not reflect the value displayed in the form
item element as long as focus is in the form item element.
getChangeOnKeypress
in class FormItem
public void setCharacterCasing(CharacterCasing characterCasing)
FormItem.setValue()
. Note: character casing cannot be
used at the same time as a mask
.
Note : This is an advanced setting
characterCasing
- Default value is TextItem.DEFAULTpublic CharacterCasing getCharacterCasing()
FormItem.setValue()
. Note: character casing cannot be
used at the same time as a mask
.
public void setEditProxyConstructor(java.lang.String editProxyConstructor)
EditProxy
for this component when the component is
first placed into edit mode
.setEditProxyConstructor
in class FormItem
editProxyConstructor
- SCClassName . Default value is "TextItemEditProxy"
public java.lang.String getEditProxyConstructor()
EditProxy
for this component when the component is
first placed into edit mode
.getEditProxyConstructor
in class FormItem
SCClassName
public void setEnforceLength(boolean enforceLength)
length
is specified for this item, should user
input be limited to the specified length? If set to true, user input and values passed to setValue()
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.
enforceLength
- Default value is truepublic boolean getEnforceLength()
length
is specified for this item, should user
input be limited to the specified length? If set to true, user input and values passed to setValue()
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.
public void setEscapeHTML(java.lang.Boolean escapeHTML)
canEdit
is false and readOnlyDisplay
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"
). Setting escapeHTML
false
will instead force HTML values in a textItem to be interpreted by the browser in that situation.escapeHTML
- Default value is trueAppearance overview and related methods
public java.lang.Boolean getEscapeHTML()
canEdit
is false and readOnlyDisplay
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"
). Setting escapeHTML
false
will instead force HTML values in a textItem to be interpreted by the browser in that situation.Appearance overview and related methods
public void setFetchMissingValues(java.lang.Boolean fetchMissingValues)
FormItem.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. See shouldFetchMissingValue()
for more details.
Note : This is an advanced setting
setFetchMissingValues
in class FormItem
fetchMissingValues
- Default value is trueFormItem.setOptionDataSource(com.smartgwt.client.data.DataSource)
,
FormItem.getSelectedRecord()
,
FormItem.setFilterLocally(java.lang.Boolean)
public java.lang.Boolean getFetchMissingValues()
FormItem.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. See shouldFetchMissingValue()
for more details.
getFetchMissingValues
in class FormItem
FormItem.getOptionDataSource()
,
FormItem.getSelectedRecord()
,
FormItem.getFilterLocally()
public void setFormatOnBlur(java.lang.Boolean formatOnBlur)
formatOnBlur
enabled, this textItem will format its value according to the rules described in FormItem.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 explicit
FormItem.formatEditorValue()
and FormItem.parseEditorValue()
pair.formatOnBlur
- Default value is falsepublic java.lang.Boolean getFormatOnBlur()
formatOnBlur
enabled, this textItem will format its value according to the rules described in FormItem.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 explicit
FormItem.formatEditorValue()
and FormItem.parseEditorValue()
pair.public void setFormatOnFocusChange(java.lang.Boolean formatOnFocusChange)
FormItem.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.formatOnFocusChange
- Default value is falsepublic java.lang.Boolean getFormatOnFocusChange()
FormItem.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.public void setKeyPressFilter(java.lang.String keyPressFilter)
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 the keyPressFilter
for this item
Note : This is an advanced setting
keyPressFilter
- new keyPress filter for the item. Default value is nullsetCharacterCasing(com.smartgwt.client.types.CharacterCasing)
,
KeyPress Filters Examplepublic java.lang.String getKeyPressFilter()
Note: keypress filtering cannot be used at the same time as a mask
.
getCharacterCasing()
,
KeyPress Filters Examplepublic void setLength(java.lang.Integer length)
enforceLength
is set to true, user input will be
limited to this value, and values exceeding this length passed to setValue()
will be trimmed. Otherwise values exceeding the
specified length will raise an error on validation. If the item has a numeric type, like integer
or float
, length is applied to the raw number value, after any specified
decimalPrecision
and decimalPad
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
.
length
- Default value is nullValidation overview and related methods
public java.lang.Integer getLength()
enforceLength
is set to true, user input will be
limited to this value, and values exceeding this length passed to setValue()
will be trimmed. Otherwise values exceeding the
specified length will raise an error on validation. If the item has a numeric type, like integer
or float
, length is applied to the raw number value, after any specified
decimalPrecision
and decimalPad
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
.
Validation overview and related methods
public void setMask(java.lang.String mask)
Sample masks:
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 |
Any character not matching one of the above mask characters or that is escaped with a backslash (\) is considered to be a literal.
Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:
Note: input
mask cannot be used at the same time as a keyPressFilter
. Also note that this property is not supported for ComboBoxItem
or SpinnerItem
, or
for items with browserInputType
set to
"digits" or "number".
If this method is called after the component has been drawn/initialized:
Set the mask 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
mask
- mask to apply to text item. Default value is nullsetKeyPressFilter(java.lang.String)
,
Text - Masked Examplepublic java.lang.String getMask()
Sample masks:
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 |
Any character not matching one of the above mask characters or that is escaped with a backslash (\) is considered to be a literal.
Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:
Note: input
mask cannot be used at the same time as a keyPressFilter
. Also note that this property is not supported for ComboBoxItem
or SpinnerItem
, or
for items with browserInputType
set to
"digits" or "number".
getKeyPressFilter()
,
Text - Masked Examplepublic void setMaskOverwriteMode(java.lang.Boolean maskOverwriteMode)
Note : This is an advanced setting
maskOverwriteMode
- Default value is nullpublic java.lang.Boolean getMaskOverwriteMode()
public void setMaskPadChar(java.lang.String maskPadChar)
Note : This is an advanced setting
maskPadChar
- Default value is " "public java.lang.String getMaskPadChar()
public void setMaskPromptChar(java.lang.String maskPromptChar)
Note : This is an advanced setting
maskPromptChar
- Default value is "_"public java.lang.String getMaskPromptChar()
public void setMaskSaveLiterals(java.lang.Boolean maskSaveLiterals)
Note : This is an advanced setting
maskSaveLiterals
- Default value is nullpublic java.lang.Boolean getMaskSaveLiterals()
public void setPrintFullText(java.lang.Boolean printFullText)
printFullText
- Default value is falsePrinting overview and related methods
public java.lang.Boolean getPrintFullText()
Printing overview and related methods
public void setSaveOnEnter(java.lang.Boolean saveOnEnter)
saveOnEnter
is true. Setting this property to
false
will disable this behavior.setSaveOnEnter
in class FormItem
saveOnEnter
- Default value is truepublic java.lang.Boolean getSaveOnEnter()
saveOnEnter
is true. Setting this property to
false
will disable this behavior.getSaveOnEnter
in class FormItem
public void setSelectOnClick(java.lang.Boolean selectOnClick)
selectOnClick
behavior to be configured
on a per-FormItem basis. Normally all items in a form default to the value of DynamicForm.selectOnClick
.setSelectOnClick
in class FormItem
selectOnClick
- Default value is nullFocus overview and related methods
public java.lang.Boolean getSelectOnClick()
selectOnClick
behavior to be configured
on a per-FormItem basis. Normally all items in a form default to the value of DynamicForm.selectOnClick
.getSelectOnClick
in class FormItem
Focus overview and related methods
public void setSelectOnFocus(java.lang.Boolean selectOnFocus)
selectOnFocus
behavior to be configured
on a per-FormItem basis. Normally all items in a form default to the value of DynamicForm.selectOnFocus
.setSelectOnFocus
in class FormItem
selectOnFocus
- Default value is nullFocus overview and related methods
public java.lang.Boolean getSelectOnFocus()
selectOnFocus
behavior to be configured
on a per-FormItem basis. Normally all items in a form default to the value of DynamicForm.selectOnFocus
.getSelectOnFocus
in class FormItem
Focus overview and related methods
public void setShowHintInField(java.lang.Boolean showHintInField)
showing 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 (see usePlaceholderForHint
),
the value of the data element
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 the textBoxStyle
with the suffix
"Hint" appended to it; or, if the item is disabled, the suffix "DisabledHint" will be used.
In RTL mode
when showRTL
is true
,
an additional "RTL" suffix will be appended; i.e. the CSS style of the data element when
the hint is displayed will be the textBoxStyle
plus "HintRTL" or "DisabledHintRTL".
To change this attribute after being drawn, it is necessary to call FormItem.redraw()
or redraw the form.
textBoxStyle
+ "Hint" /
"HintRTL" / "DisabledHint" / "DisabledHintRTL" styles. For example, if this item's
textBoxStyle
is set to "mySpecialItem", then changing the hint color to
blue can be accomplished with the following CSS:
.mySpecialItemHint, .mySpecialItemHintRTL, .mySpecialItemDisabledHint, .mySpecialItemDisabledHintRTL { color: blue; }
Note : This is an advanced setting
showHintInField
- Default value is nullFormItem.setHint(java.lang.String)
,
setUsePlaceholderForHint(boolean)
,
Appearance overview and related methods
public java.lang.Boolean getShowHintInField()
showing 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 (see usePlaceholderForHint
),
the value of the data element
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 the textBoxStyle
with the suffix
"Hint" appended to it; or, if the item is disabled, the suffix "DisabledHint" will be used.
In RTL mode
when showRTL
is true
,
an additional "RTL" suffix will be appended; i.e. the CSS style of the data element when
the hint is displayed will be the textBoxStyle
plus "HintRTL" or "DisabledHintRTL".
To change this attribute after being drawn, it is necessary to call FormItem.redraw()
or redraw the form.
textBoxStyle
+ "Hint" /
"HintRTL" / "DisabledHint" / "DisabledHintRTL" styles. For example, if this item's
textBoxStyle
is set to "mySpecialItem", then changing the hint color to
blue can be accomplished with the following CSS:
.mySpecialItemHint, .mySpecialItemHintRTL, .mySpecialItemDisabledHint, .mySpecialItemDisabledHintRTL { color: blue; }
FormItem.getHint()
,
getUsePlaceholderForHint()
,
Appearance overview and related methods
public void setSupportsCutPasteEvents(boolean supportsCutPasteEvents)
This attribute only applies to freeform text entry
fields such as TextItem
and TextAreaItem
, and only if changeOnKeypress
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 the FormItem.isCutEvent()
and FormItem.isPasteEvent()
methods. This allows custom cut/paste handling to be added to the various change notification flow methods including
FormItem.change()
, FormItem.handleChange()
and FormItem.transformInput()
.
setSupportsCutPasteEvents
in class FormItem
supportsCutPasteEvents
- Default value is truepublic boolean getSupportsCutPasteEvents()
This attribute only applies to freeform text entry
fields such as TextItem
and TextAreaItem
, and only if changeOnKeypress
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 the FormItem.isCutEvent()
and FormItem.isPasteEvent()
methods. This allows custom cut/paste handling to be added to the various change notification flow methods including
FormItem.change()
, FormItem.handleChange()
and FormItem.transformInput()
.
getSupportsCutPasteEvents
in class FormItem
public void setTextBoxStyle(java.lang.String textBoxStyle)
CompoundFormItem_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.
setTextBoxStyle
in class FormItem
textBoxStyle
- FormItemBaseStyle . Default value is "textItem"
,
Appearance overview and related methods
public java.lang.String getTextBoxStyle()
CompoundFormItem_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.
getTextBoxStyle
in class FormItem
FormItemBaseStyle
,
Appearance overview and related methods
public void setUsePlaceholderForHint(boolean usePlaceholderForHint)
showing the hint in field
and if
supported by the browser, should the HTML5
placeholder
attribute
be used to display the hint within the field? If set to false
, then use of
the placeholder
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:
WebView
(used by the stock Browser app and when
packaging with PhoneGap
)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.
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; } }
Note : This is an advanced setting
usePlaceholderForHint
- Default value is trueFormItem.setHint(java.lang.String)
,
Appearance overview and related methods
public boolean getUsePlaceholderForHint()
showing the hint in field
and if
supported by the browser, should the HTML5
placeholder
attribute
be used to display the hint within the field? If set to false
, then use of
the placeholder
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:
WebView
(used by the stock Browser app and when
packaging with PhoneGap
)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.
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; } }
FormItem.getHint()
,
Appearance overview and related methods
public void deselectValue()
public void deselectValue(java.lang.Boolean start)
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 insteadpublic java.lang.String getEnteredValue()
FormItem.getValue()
in various cases - for example: DateItem
with
enforceDate
:true, or a ComboBoxItem
with addUnknownValues
:falsechangeOnKeypress
is false public java.lang.String getHint()
FormItem.hint
, or null if there is no hint to show.getHint
in class FormItem
Appearance overview and related methods
public int[] getSelectionRange()
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 a mouseDown()
or mouseOver()
handler.
Notes:
setValue()
or otherwise changing
the entered value
invalidates the past
selection range.getValue()
. The distinction is
particularly important for TextAreaItem
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.entered value
. In IE 6-9, returns null if the
item does not have focus.public boolean pendingStatusChanged(DynamicForm form, FormItem item, boolean pendingStatus, java.lang.Object newValue, java.lang.Object value)
showPending
is
enabled and this text item should either clear or show its pending visual state. The default behavior is that the
titleStyle
, cellStyle
, and textBoxStyle
are updated to include/exclude the
"Pending" suffix. Returning false
will cancel this default behavior.
form
- the managing DynamicForm
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 to DynamicForm.resetValues()
.false
to cancel the default behavior.public void selectValue()
public void setSelectionRange(int start, int end)
start
- selection starting character indexend
- end of selection character indexpublic java.lang.Boolean shouldFetchMissingValue(java.lang.Object newValue)
optionDataSource
, 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
unless FormItem.alwaysFetchMissingValues
is true,
even if there is a specified displayField
. 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.
shouldFetchMissingValue
in class FormItem
newValue
- The new data value of the item.public void setPastedValueTransformer(PastedValueTransformer customizer)
pastedValue
argument contains the text pasted from the clipboard. This
method should return the text value to actually insert into the input element.PastedValueTransformer
- customizerpublic static void setDefaultProperties(TextItem textItemProperties)
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.
textItemProperties
- properties that should be used as new defaults when instances of this class are createdSGWTProperties
public java.lang.String getValueAsString()