Date Field
import {DateField} from 'cx/widgets';Date field control is used for selecting dates. It supports textual input and picking from a dropdown.
<div layout={LabelsLeftLayout}>
<DateField label="Standard" value-bind="$page.date" format="datetime;yyyyMMMMdd" autoFocus/>
<DateField label="Disabled" value-bind="$page.date" disabled />
<DateField label="Readonly" value-bind="$page.date" readOnly />
<DateField label="Placeholder" value-bind="$page.date" placeholder="Type something here..." />
<DateField label="DisabledDaysOfWeek" value-bind="$page.date" disabledDaysOfWeek={[0, 6]} />
<DateField label="Focus Input First" value-bind="$page.date" focusInputFirst />
</div>
<div layout={LabelsLeftLayout}>
<DateField label="Required" value-bind="$page.date" required />
<DateField label="Styled" value-bind="$page.date" inputStyle={{border: '1px solid green'}} icon="clock-o"/>
<DateField label="View" value-bind="$page.date" mode="view" />
<DateField label="EmptyText" value-bind="$page.date" mode="view" emptyText="N/A" />
</div>| Property | Description | Type |
|---|---|---|
format | Date format used to display the selected date. See Formatting for more details. | string |
partial | Preserves date or time segment set by some other field. Useful in Date/Time combos. | string |
value | Selected date. This should be a | string/Date |
alwaysShowClear | Set to | boolean |
autoFocus | Set to | boolean |
autoOpen | Set to | boolean |
baseClass | Base CSS class to be applied to the field. Defaults to | string |
class | Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list. | string/object |
disabled | Defaults to | boolean |
disabledDaysOfWeek | Defines which days of week should be displayed as disabled, i.e. | array |
emptyText | Text to be rendered in view mode when the field is empty. | string |
enabled | The opposite of | boolean |
encoding | Sets the function that will be used to convert Date objects before writing data to the store.
Default implementation is | function |
error | Used for validation. If error evaluates to non-null, the field is marked in red. | string |
focusInputFirst | Set to | boolean |
help | Additional content to be displayed next to the field. This is commonly used for presenting additional information or validation errors. | string/config |
helpPlacement | Set to | string |
helpSpacer | Indicates that | boolean |
hideClear | Set to | boolean |
icon | Name or configuration of the icon to be put on the left side of the input. | string/object |
id | Id to be used on rendered input. | string |
inputAttrs | Additional attributes that should be rendered on the input element.
E.g. | object |
inputClass | Additional CSS class applied to the input element. Used for setting visual elements, such as borders and backgrounds. | string/object |
inputStyle | Style object applied to the input element. Used for setting visual elements, such as borders and backgrounds. | string/object |
label | Field label. For advanced use cases, see Labels. | string/config |
labelClass | Additional CSS class to be passed to the label object. | string |
labelPlacement | Set to | string |
labelStyle | Additional CSS styles to be passed to the label object. | string/object |
maxExclusive | Set to | boolean |
maxValue | Maximum date value. This should be a | string/Date |
minExclusive | Set to | boolean |
minValue | Minimum date value. This should be a | string/Date |
mod | Appearance modifier. For example, | string/array |
mode | Either | string |
onParseInput | Callback used for parsing custom input, e.g. 'today'.
Returns | function |
outerLayout | Defines the outer layout which wraps the widget. | widget |
placeholder | Default text displayed when the field is empty. | string |
putInto | Used with outer layouts. Specifies the name of the content placeholder which should render the widget. | string |
readOnly | Defaults to | boolean |
required | Defaults to | boolean |
segment | Defines which segment of the date/time object is affected by this field.
Allowed values are | string |
showClear | Set to | string |
style | Style object applied to the wrapper div. Used for setting the dimensions of the element. | string/object |
tabIndex | Custom tab index to be set on the field. | string |
tabOnEnterKey | Set to | boolean |
tooltip | Tooltip configuration. For more info see Tooltips. | string/object |
trackFocus | If set to | boolean |
validationMode | Defines how to present validation errors. Default mode is | string |
validationParams | An structured binding for additional validation parameters. Useful if validation depends on values
from other fields, e.g. confirm password. Calculated value is passed as the third argument to | structure |
vdomKey | Key that will be used as the key when rendering the React component. | string |
viewMode | Set to | boolean |
visible | Visibility of the widget. Defaults to | boolean |
visited | Validation errors are not shown until the user visits the field. Setting this field to | boolean |