Component: ojInputDateTime

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

Options


Non-public Fields (internal use only)
Binding Attributes
Sub-ID's

oj. ojInputDateTime extends oj.ojInputDate

Version:
  • 3.2.0
Since:
  • 0.6

JET ojInputDateTime Component

Description: ojInputDateTime extends from ojInputDate providing additionally time selection drop down.

Touch End User Information

Target Gesture Action
Input element and calendar trigger icon Tap When not inline, shows the grid and moves the focus into the expanded date grid.
Time trigger icon Tap Shows the time picker and moves the focus into the expanded time picker
Input element with picker open Tap Set focus to the input. If hints, title or messages exist in a notewindow, pop up the notewindow.
Label's help icon Tap If there is a help source URL on the anchor icon, navigate to the Help Source URL. Otherwise, show the help definition text in a popup.
Press & Hold Show help definition text in a popup.
Picker Swipe Left Switch to next month (or previous month on RTL page).
Picker Swipe Right Switch to previous month (or next month on RTL page).

Keyboard End User Information

Target Key Action
Input element DownArrow or UpArrow When not in inline mode, shows the calendar grid and moves the focus into the expanded grid. When in inline mode, shows the time picker and moves the focus into the expanded time picker
Input element Shift + DownArrow or UpArrow Shows the time picker and moves the focus into the expanded time picker
Input element Esc Close the grid.
Input Element Tab In Set focus to the input. If hints, title or messages exist in a notewindow, pop up the notewindow.
Picker Enter Select the currently focused day
Picker UpArrow Move up in the grid.
Picker DownArrow Move down in the grid.
Picker RightArrow Move right in the grid.
Picker LeftArrow Move left in the grid.
Picker Esc Close the grid.
Picker Home Move focus to first day of the month.
Picker End Move focus to last day of the month.
Picker PageUp Switch to previous month.
Picker PageDown Switch to next month.
Picker Alt + PageUp Switch to previous year.
Picker Alt + PageDown Switch to next year.
Picker Ctrl + Alt + PageUp Switch to previous by stepBigMonths.
Picker Ctrl + Alt + PageDown Switch to next by stepBigMonths.
Picker Ctrl + Alt + T Places focus on Today button if it exists.
Label's help icon Enter Go the Help Source URL.
Tab In Show help definition text.

Pseudo-selectors

$( ":oj-inputDateTime" )            // selects all JET input on the page

Accessibility

It is up to the application developer to associate the label to the input component. For inputDateTime, you should put an id on the input, and then set the for attribute on the label to be the input's id.

Label and InputDateTime

For accessibility, you should associate a label element with the input by putting an id on the input, and then setting the for attribute on the label to be the input's id.

The component will decorate its associated label with required and help information, if the required and help options are set.

Declarative Binding


   <input id="dateTimeId" data-bind="ojComponent: {component: 'ojInputDateTime'}" />

Initializer

.ojInputDateTime(options)

Creates or re-initializes a JET ojInputDateTime
Parameters:
Name Type Argument Description
options Object <optional>
a map of option-value pairs to set on the component
Source:
Examples

Initialize the input element with no options specified:

$( ".selector" ).ojInputDateTime();

* @example Initialize the input element with some options:
$( ".selector" ).ojInputDateTime( { "disabled": true } );

Initialize the input element via the JET ojComponent binding:

<input id="dateTimeId" data-bind="ojComponent: {component: 'ojInputDateTime'}" />

Options

contextMenu :Element|Array.<Element>|string|jQuery|NodeList

Identifies the JET Menu that the component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the specified JET Menu.

The value can be an HTML element, JQ selector, JQ object, NodeList, or array of elements. In all cases, the first indicated element is used.

To specify a JET context menu on a DOM element that is not a JET component, see the ojContextMenu binding.

To make the page semantically accurate from the outset, applications are encouraged to specify the context menu via the standard HTML5 syntax shown in the below example. When the component is initialized, the context menu thus specified will be set on the component.

There is no restriction on the order in which the JET Menu and the referencing component are initialized. However, when specifying the Menu via the HTML attribute, the referenced DOM element must be in the document at the time that the referencing component is initialized.

After create time, the contextMenu option should be set via this API, not by setting the DOM attribute.

The application can register a listener for the Menu's beforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.

To help determine whether it's appropriate to cancel the launch or customize the menu, the beforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc and demos of the individual components for details. Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.

Default Value:
  • null
Inherited From:
Source:
Examples

Initialize a JET component with a context menu:

// via recommended HTML5 syntax:
<div id="myComponent" contextmenu="myMenu" data-bind="ojComponent: { ... }>

// via JET initializer (less preferred) :
// Foo is the component, e.g., InputText, InputNumber, Select, etc.
$( ".selector" ).ojFoo({ "contextMenu": "#myMenu" });

Get or set the contextMenu option, after initialization:

// getter
// Foo is the component, e.g., InputText, InputNumber, Select, etc.
var menu = $( ".selector" ).ojFoo( "option", "contextMenu" );

// setter
// Foo is the component, e.g., InputText, InputNumber, Select, etc.
$( ".selector" ).ojFoo( "option", "contextMenu", ".my-marker-class" );

Set a JET context menu on an ordinary HTML element:

<a href="#" id="myAnchor" contextmenu="myMenu" data-bind="ojContextMenu: {}">Some text

converter

Default converter for ojInputDateTime If one wishes to provide a custom converter for the ojInputDateTime override the factory returned for oj.Validation.converterFactory(oj.ConverterFactory.CONVERTER_TYPE_DATETIME)
Default Value:
  • oj.Validation.converterFactory(oj.ConverterFactory.CONVERTER_TYPE_DATETIME).createConverter({"day": "2-digit", "month": "2-digit", "year": "2-digit", "hour": "2-digit", "minute": "2-digit"})
Source:

datePicker :Object

Note that Jet framework prohibits setting subset of options which are object types.

For example $(".selector").ojInputDate("option", "datePicker", {footerLayout: "today"}); is prohibited as it will wipe out all other sub-options for "datePicker" object.

If one wishes to do this [by above syntax or knockout] one will have to get the "datePicker" object, modify the necessary sub-option and pass it to above syntax.

Default values for the datePicker sub-options can also be overridden with the theming variable $inputDateTimeDatePickerOptionDefault, which is merged with other defaults.

Note that all of the datePicker sub-options except showOn are not available when renderMode is 'native'.

The properties supported on the datePicker option are:

Properties:
Name Type Argument Description
footerLayout string <optional>
Will dictate what content is shown within the footer of the calendar.

The default value is {datePicker: {footerLayout: "today"}} with possible values being
  • "" - Do not show anything
  • "today" - the today button

Example $(".selector").ojInputDate("option", "datePicker.footerLayout", "today");
changeMonth string <optional>
Whether the month should be rendered as a button to allow selection instead of text.

The default value is {datePicker: {changeMonth: "select"}} with possible values being
  • "select" - As a button
  • "none" - As a text

Example $(".selector").ojInputDate("option", "datePicker.changeMonth", "none");
changeYear string <optional>
Whether the year should be rendered as a button to allow selection instead of text.

The default value is {datePicker: {changeYear: "select"}} with possible values being
  • "select" - As a button
  • "none" - As a text

Example $(".selector").ojInputDate("option", "datePicker.changeYear", "none");
currentMonthPos number <optional>
The position in multipe months at which to show the current month (starting at 0).

The default value is {datePicker: {currentMonthPos: 0}}

Example $(".selector").ojInputDate("option", "datePicker.currentMonthPos", 1);
daysOutsideMonth string <optional>
Dictates the behavior of days outside the current viewing month.

The default value is {datePicker: {daysOutsideMonth: "hidden"}} with possible values being
  • "hidden" - Days outside the current viewing month will be hidden
  • "visible" - Days outside the current viewing month will be visible
  • "selectable" - Days outside the current viewing month will be visible + selectable

Example $(".selector").ojInputDate("option", "datePicker.daysOutsideMonth", "visible");
numberOfMonths number <optional>
The number of months to show at once. Note that if one is using a numberOfMonths > 4 then one should define a CSS rule for the width of each of the months. For example if numberOfMonths is set to 6 then one should define a CSS rule .oj-datepicker-multi-6 .oj-datepicker-group providing the width each month should take in percentage.

The default value is {datePicker: {numberOfMonths: 1}}

Example $(".selector").ojInputDate("option", "datePicker.numberOfMonths", 2);
showOn string <optional>
When the datepicker should be shown.

Possible values are
  • "focus" - when the element receives focus or when the trigger calendar image is clicked. When the picker is closed, the field regains focus and is editable.
  • "image" - when the trigger calendar image is clicked

Example to initialize the inputDate with showOn option specified $(".selector").ojInputDate("option", "datePicker.showOn", "focus");
stepMonths string | number <optional>
How the prev + next will step back/forward the months.

The default value is {datePicker: {stepMonths: "numberOfMonths"}}
  • "numberOfMonths" - Will use numberOfMonths option value as value
  • number - Number of months to step back/forward

Example $(".selector").ojInputDate("option", "datePicker.stepMonths", 2);
stepBigMonths number <optional>
Number of months to step back/forward for the (Alt + Page up) + (Alt + Page down) key strokes.

The default value is {datePicker: {stepBigMonths: 12}}

Example $(".selector").ojInputDate("option", "datePicker.stepBigMonths", 3);
weekDisplay string <optional>
Whether week of the year will be shown.

The default value is {datePicker: {weekDisplay: "none"}}
  • "number" - Will show the week of the year as a number
  • "none" - Nothing will be shown

Example $(".selector").ojInputDate("option", "datePicker.weekDisplay", "number");
yearRange string <optional>
The range of years displayed in the year drop-down: either relative to today's year ("-nn:+nn"), relative to the currently selected year ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats ("nnnn:-nn").

The default value is {datePicker: {yearRange: "c-10:c+10"}}

Example $(".selector").ojInputDate("option", "datePicker.yearRange", "c-5:c+10");

Inherited From:
Source:
Example

Override defaults in the theme (SCSS) :

$inputDateTimeDatePickerOptionDefault: (footerLayout: 'today', weekDisplay: 'number') !default;

dayFormatter :Function

Additional info to be used when rendering the day This should be a JavaScript Function reference which accepts as its argument the following JSON format {fullYear: Date.getFullYear(), month: Date.getMonth()+1, date: Date.getDate()} and returns null or all or partial JSON data of {disabled: true|false, className: "additionalCSS", tooltip: 'Stuff to display'}
Default Value:
  • null
Inherited From:
Source:

dayMetaData

Additional info to be used when rendering the day This should be in the following JSON format with the year, month, day based on Date.getFullYear(), Date.getMonth()+1, and Date.getDate(): {year: {month: {day: {disabled: true|false, className: "additionalCSS", tooltip: 'Stuff to display'}}} There also exists a special '*' character which represents ALL within that field [i.e. * within year, represents for ALL year]. Note that this option will override the value of the dayFormatter option. Setting both dayFormatter and dayMetaData options is not supported.
Default Value:
  • null
Inherited From:
Source:
Example
 {2013: {11: {25: {disabled: true, className: 'holiday', tooltip: 'Stuff to display'}, 5: {disabled: true}}}}}

disabled :boolean

Whether the component is disabled. The element's disabled property is used as its initial value if it exists, when the option is not explicitly set. When neither is set, disabled defaults to false.

The 2-way disabled binding offered by the ojComponent binding should be used instead of Knockout's built-in disable and enable bindings, as the former sets the API, while the latter sets the underlying DOM attribute.

When the disabled option changes due to programmatic intervention, the component may clear messages and run validation in some cases.

  • when a required component is initialized as disabled {value: null, required:true, disabled: true}, deferred validation is skipped.
  • when a disabled component is enabled,
    • if component is invalid and showing messages then all component messages are cleared, and full validation run using the display value.
      • if there are validation errors, they are pushed to messagesShown option.
      • if no errors result from the validation, the value option is updated. Page authors can listen to the optionChange event on the value option to clear custom errors.
    • if component is valid and has no errors then deferred validation is run.
      • if there is a deferred validation error, then messagesHidden option is updated.
    • if component is invalid and deferred errors then component messages are cleared and deferred validation re-run.
      • if there is a deferred validation error, then messagesHidden option is updated.
  • when enabled component is disabled then no validation is run and the component appears disabled.

Default Value:
  • false
Inherited From:
Source:
Example

Initialize component with disabled option:

$(".selector").ojFoo({"disabled": true}); // Foo is InputText, InputNumber, Select, etc.

displayOptions :Object|undefined

Display options for auxilliary content that determines where it should be displayed in relation to the component.

The types of messaging content for which display options can be configured include messages, converterHint, validatorHint and title.
The display options for each type is specified either as an array of strings or a string. When an array is specified the first display option takes precedence over the second and so on.

JET editable components set defaults that apply to the entire app/page. It is possible to override the defaults on a per instance basis as explained in the examples below or change defaults for the entire application using oj.Components#setDefaultOptions method. It is much easier to change the defaults using setDefaultOptions once rather than putting the displayOptions option on every component instance.

When displayOptions changes due to programmatic intervention, the component updates its display to reflect the updated choices. For example, if 'title' property goes from 'notewindow' to 'none' then it no longer shows in the notewindow.

A side note: title and message detail text can include formatted HTML text, whereas hints and message summary text cannot. If you use formatted text, it should be accessible and make sense to the user if formatting wasn't there. To format the title, you could do this:

<html>Enter <b>at least</b> 6 characters</html>

Properties:
Name Type Argument Description
converterHint Array | string <optional>
supported values are 'placeholder', 'notewindow', 'none'. The default value is ['placeholder', 'notewindow']. When there is already a placeholder set on the component, the converter hint falls back to display type of 'notewindow'. To change the default value you can do this -
E.g. {'displayOptions: {'converterHint': ['none']}}
validatorHint Array | string <optional>
supported values are 'notewindow', 'none'. To change the default value you can do this -
{'displayOptions: {'validatorHint': ['none']}}
messages Array | string <optional>
supported values are 'notewindow', 'inline', 'none'. The default is 'inline'. To change the default value you can do this -
E.g. {'displayOptions: {'messages': 'none'}}
title Array | string <optional>
supported values are 'notewindow', 'none'. To change the default value you can do this -
E.g. {'displayOptions: {'title': 'none'}}
Default Value:
  • {
      'messages': ['inline'],
      'converterHint': ['placeholder', 'notewindow'],
      'validatorHint': ['notewindow'],
      'title': ['notewindow']
    }
Since:
  • 0.7
Inherited From:
Source:
Examples

Override default values for displayOptions for messages for the entire application:

// messages will be shown in the notewindow for the application.
oj.Components.setDefaultOptions({
   'editableValue':
   {
     'displayOptions': 
     {
       'messages': ['notewindow']
     }
   }
});

Override default values for displayOptions for one component instance:

// In this example, the instance of ojFoo changes its displayOptions from the defaults.
// The 'converterHint' is none, the 'validatorHint' is none and the 'title' is none,
// so only the 'messages' will display in its default state.
// For most apps, you will want to change the displayOptions app-wide
// for all EditableValue components, so you should use the
// oj.Components#setDefaultOptions function instead (see previous example).
//
// Foo is InputText, InputNumber, Select, etc.
$(".selector").ojFoo("option", "displayOptions", {
  'converterHint': 'none',
  'validatorHint': 'none',
  'title' : 'none'
});

help :Object.<string, string>

Help information that goes on the label. When help is set on the input component, then help information is added to the input's label.

The properties supported on the help option are:

Properties:
Name Type Argument Description
definition string <optional>
this is the help definition text. It is what shows up when the user hovers over the help icon, or tabs into the help icon, or press and holds the help icon on a mobile device. No formatted text is available for the help definition attribute. The default value is null.
source string <optional>
this is the help source url. If present, the help icon's anchor's target is this source. For security reasons we only support urls with protocol http: or https:. If the url doesn't comply we ignore it and throw an error. The default value is null. Pass in an encoded URL since we do not encode the URL.
Default Value:
  • {help : {definition :null, source: null}}
Inherited From:
Source:
Examples

Initialize the input with the help definition and external url information:

// Foo is InputText, InputNumber, Select, etc.
$( ".selector" ).ojFoo({ "help": {"definition":"some help definition, "source":"some external url" } });

Set the help option, after initialization:

// setter
// Foo is InputText, InputNumber, Select, etc.
$( ".selector" ).ojFoo( "option", "help", {"definition":"fill out the name", "source":"http:\\www.oracle.com" } );

help.definition :string

help definition text. See the top-level help option for details.

Default Value:
  • null
Inherited From:
Source:
Example

Get or set the help.definition sub-option, after initialization:

// getter
var definitionText = $( ".selector" ).ojFoo( "option", "help.definition" );

// setter:
$( ".selector" ).ojFoo( "option", "help.definition", "Enter your name" );

help.source :string

help source url. See the top-level help option for details.

Default Value:
  • null
Inherited From:
Source:
Example

Get or set the help.source sub-option, after initialization:

// getter
var helpSource = $( ".selector" ).ojFoo( "option", "help.source" );

// setter:
$( ".selector" ).ojFoo( "option", "help.source", "www.abc.com" );

keyboardEdit :string

Determines if keyboard entry of the text is allowed. When disabled the picker must be used to select a date.
Supported Values:
Name Type Description
"enabled" string Allow keyboard entry of the date.
"disabled" string Changing the date can only be done with the picker.
Default Value:
  • Default value depends on the theme. In alta-android, alta-ios and alta-windows themes, the default is "disabled" and it's "enabled" for alta web theme.
Inherited From:
Source:
Example

Initialize the component with the keyboardEdit option:

<input id="date" data-bind="ojComponent: {component: 'ojInputDate', keyboardEdit: 'disabled'}" />
// Example to set the default in the theme (SCSS)
$inputDateTimeKeyboardEditOptionDefault: disabled !default;

max

The maximum selectable datetime. When set to null, there is no maximum.
  • type string - ISOString
  • null - no limit
Default Value:
  • null
Source:
Example

Initialize the component with the max option:

<input id="date" data-bind="ojComponent: {component: 'ojInputDateTime', max: '2014-09-25T13:30:00.000-08:00'}" />

messagesCustom :Array|undefined

List of messages an app would add to the component when it has business/custom validation errors that it wants the component to show. When this option is set the messagesShown option is also updated and the message shows to the user right away. To clear the custom message, set code class="prettyprint">messagesCustom back to an empty array.
Each message in the array is either an instance of oj.Message or an object that duck types it. See oj.Message for details.

An optionChange event is triggered every time this option value changes.

Default Value:
  • empty array when no option is set.
Since:
  • 0.7
Inherited From:
Source:
See:
Examples

Get the current list of app messages using messagesCustom option:

// Foo is InputText, InputNumber, Select, etc.
var customMsgs = $(".selector").ojFoo("option", "messagesCustom"); 

Clear all app messages set on the component:

// Foo is InputText, InputNumber, Select, etc.
$(".selector").ojFoo("option", "messagesCustom", []); 

Set app messages using the messagesCustom option:

var msgs = [];
msgs.push({'summary': 'Error Summary', 'detail': 'Error Detail'}); 
// Foo is InputText, InputNumber, Select, etc.
$(".selector").ojFoo("option", "messagesCustom", msgs);

<readonly> messagesHidden :Array|undefined

List of messages currently hidden on component, these are added by component when it runs deferred validation. Each message in the array is either an instance of oj.Message or an object that duck types it. See oj.Message for details.

This is a read-only option so page authors cannot set or change it directly.

An optionChange event is triggered every time this option value changes.

These messages are not shown to the end-user by default, but page author can show hidden messages using the showMessages method.

Default Value:
  • empty array when no option is set.
Since:
  • 0.7
Inherited From:
Source:
See:
Example

Get messagesShown for the component:

// Foo is InputText, InputNumber, Select, etc.
var messages = $(".selector").ojFoo("option", "messagesShown"); 

<readonly> messagesShown :Array|undefined

List of messages currently shown on component, these include messages generated both by the component and ones provided by app using messagesCustom. Each message in the array is either an instance of oj.Message or an object that duck types it. See oj.Message for details.

This is a read-only option so page authors cannot set or change it directly.

An optionChange event is triggered every time its value changes.

Messages retrieved using the messagesShown option are by default shown in the notewindow, but this can be controlled using the 'messages' property of the displayOptions option.

Default Value:
  • empty array when no option is set.
Since:
  • 0.7
Inherited From:
Source:
Example

Get messagesShown for the component:

// Foo is InputText, InputNumber, Select, etc.
var messages = $(".selector").ojFoo("option", "messagesShown"); 

min

The minimum selectable date. When set to null, there is no minimum.
  • type string - ISOString
  • null - no limit
Default Value:
  • null
Source:
Example

Initialize the component with the min option:

<input id="date" data-bind="ojComponent: {component: 'ojInputDateTime', min: '2014-08-25T08:00:00.000-08:00'}" />

pickerAttributes :Object

Attributes specified here will be set on the picker DOM element when it's launched.

The supported attributes are class and style, which are appended to the picker's class and style, if any. Note: 1) pickerAttributes is not applied in the native theme. 2) setting this option after component creation has no effect.

Default Value:
  • null
Inherited From:
Source:
Examples

Initialize the inputDate specifying a set of attributes to be set on the picker DOM element:

$( ".selector" ).ojInputDate({ "pickerAttributes": {
  "style": "color:blue;",
  "class": "my-class"
}});

Get the pickerAttributes option, after initialization:

// getter
var inputDate = $( ".selector" ).ojInputDate( "option", "pickerAttributes" );

placeholder

The placeholder text to set on the element. Though it is possible to set placeholder attribute on the element itself, the component will only read the value when the component is created. Subsequent changes to the element's placeholder attribute will not be picked up and page authors should update the option directly.
Default Value:
  • when the option is not set, the element's placeholder attribute is used if it exists. If the attribute is not set then the default can be the converter hint provided by the datetime converter. See displayOptions for details.
Inherited From:
Source:
Examples

Initialize the component with the placeholder option:

<!-- Foo is InputDate, InputDateTime />
<input id="date" data-bind="ojComponent: {component: 'ojFoo', placeholder: 'Birth Date'}" />

Initialize placeholder option from html attribute:

<!-- Foo is InputDate, InputDateTime />
<input id="date" data-bind="ojComponent: {component: 'ojFoo'}" placeholder="User Name" />

<readonly> rawValue :string|undefined

The rawValue is the read-only option for retrieving the current value from the input field in text form.

The rawValue updates on the 'input' javascript event, so the rawValue changes as the value of the input is changed. If the user types in '1,200' into the field, the rawValue will be '1', then '1,', then '1,2', ..., and finally '1,200'. Then when the user blurs or presses Enter the value option gets updated.

This is a read-only option so page authors cannot set or change it directly.

Default Value:
  • n/a
Since:
  • 1.2
Inherited From:
Source:

readOnly :boolean|undefined

Dictates component's readOnly state. Note that option value always supercedes element's attribute value and it is best practice to pass the value as an option than to set it as an element's attribute.
Default Value:
  • false
Inherited From:
Source:
Example

Initialize component with readOnly option:

// Foo is InputText, InputPassword, TextArea, etc.
$(".selector").ojFoo({"readOnly": true});

renderMode :string

The renderMode option allows applications to specify whether to render date and time pickers in JET or as a native picker control.
Valid values: jet, native
  • jet - Applications get full JET functionality.
  • native - Applications get the functionality of the native picker.

  • Note that the native picker support is limited to Cordova plugin published at 'https://github.com/VitaliiBlagodir/cordova-plugin-datepicker'.
    With native renderMode, the functionality that is sacrificed compared to jet renderMode are:
    • Date and time pickers cannot be themed
    • Accessibility is limited to what the native picker supports
    • pickerAttributes is not applied
    • Sub-IDs are not available
    • hide() and hideTimePicker() functions are no-op
    • translations sub options pertaining to the picker is not available
    • All of the 'datepicker' sub-options except 'showOn' are not available
    • 'timePicker.timeIncrement' option is limited to iOS and will only take a precision of minutes
Default Value:
  • value depends on the theme. In alta-android, alta-ios and alta-windows themes, the default is "native" and it's "jet" for alta web theme.
Source:
Example

Get or set the renderMode option for an ojInputDateTime after initialization:

// getter
var renderMode = $( ".selector" ).ojInputDateTime( "option", "renderMode" );
// setter
$( ".selector" ).ojInputDateTime( "option", "renderMode", "native" );
// Example to set the default in the theme (SCSS)
$inputDateTimeRenderModeOptionDefault: native !default;

required :boolean

Whether the component is required or optional. When required is set to true, an implicit required validator is created using the validator factory - oj.Validation.validatorFactory(oj.ValidatorFactory.VALIDATOR_TYPE_REQUIRED).createValidator(). Translations specified using the translations.required option and the label associated with the component, are passed through to the options parameter of the createValidator method.

When required option changes due to programmatic intervention, the component may clear messages and run validation, based on the current state it's in.

Running Validation

  • if component is valid when required is set to true, then it runs deferred validation on the option value. This is to ensure errors are not flagged unnecessarily.
    • if there is a deferred validation error, then messagesHidden option is updated.
  • if component is invalid and has deferred messages when required is set to false, then component messages are cleared but no deferred validation is run.
  • if component is invalid and currently showing invalid messages when required is set, then component messages are cleared and normal validation is run using the current display value.
    • if there are validation errors, then value option is not updated and the error pushed to messagesShown option.
    • if no errors result from the validation, the value option is updated; page author can listen to the optionChange event on the value option to clear custom errors.

Clearing Messages

  • Only messages created by the component are cleared. These include ones in messagesHidden and messagesShown options.
  • messagesCustom option is not cleared.

Supported Values:
Name Type Description
false boolean implies a value is not required to be provided by the user. This is the default.
true boolean implies a value is required to be provided by user and the input's label will render a required icon. Additionally a required validator - oj.RequiredValidator - is implicitly used if no explicit required validator is set. An explicit required validator can be set by page authors using the validators option.
Default Value:
  • false
Since:
  • 0.7
Inherited From:
Source:
See:
Examples

Initialize the component with the required option:

$(".selector").ojFoo({required: true}); // Foo is InputText, InputPassword, TextArea, etc.

Initialize required option from html attribute 'required':

<input type="text" value= "foobar" required/>
// retreiving the required option returns true $(".selector").ojFoo("option", "required"); // Foo is InputText, InputPassword, TextArea, etc.

Customize messages and hints used by implicit required validator when required option is set:

<!-- Foo is InputText, InputPassword, TextArea, etc. -->
<input type="text" value="foobar" required data-bind="ojComponent: {
  component: 'ojFoo', 
  value: password, 
  translations: {'required': {
                hint: 'custom: enter at least 3 alphabets',
                messageSummary: 'custom: \'{label}\' is Required', 
                messageDetail: 'custom: please enter a valid value for \'{label}\''}}}"/>

rootAttributes :Object

Attributes specified here will be set on the component's root DOM element at creation time. This is particularly useful for components like Dialog that wrap themselves in a new root element at creation time.

The supported attributes are id, which overwrites any existing value, and class and style, which are appended to the current class and style, if any.

Setting this option after component creation has no effect. At that time, the root element already exists, and can be accessed directly via the widget method, per the second example below.

Default Value:
  • null
Inherited From:
Source:
Examples

Initialize a JET component, specifying a set of attributes to be set on the component's root DOM element:

// Foo is the component, e.g., Menu, Button, InputText, InputNumber, Select, etc.
$( ".selector" ).ojFoo({ "rootAttributes": {
  "id": "myId",
  "style": "max-width:100%; color:blue;",
  "class": "my-class"
}});

After initialization, rootAttributes should not be used. It is not needed at that time, as attributes of the root DOM element can simply be set directly, using widget:

// Foo is the component, e.g., Menu, Button, InputText, InputNumber, Select, etc.
$( ".selector" ).ojFoo( "widget" ).css( "height", "100px" );
$( ".selector" ).ojFoo( "widget" ).addClass( "my-class" );

timePicker :Object

Note that Jet framework prohibits setting subset of options which are object types.

For example $(".selector").ojInputDateTime("option", "timePicker", {timeIncrement': "00:30:00:00"}); is prohibited as it will wipe out all other sub-options for "timePicker" object.

If one wishes to do this [by above syntax or knockout] one will have to get the "timePicker" object, modify the necessary sub-option and pass it to above syntax.

The properties supported on the timePicker option are:

Properties:
Name Type Argument Description
timeIncrement string <optional>
Time increment to be used for ojInputDateTime, the format is hh:mm:ss:SS.

Note that when renderMode is 'native', timeIncrement option is limited to iOS and will only take a precision of minutes.

The default value is {timePicker: {timeIncrement': "00:05:00:00"}}.

Example $(".selector").ojInputDateTime("option", "timePicker.timeIncrement", "00:10:00:00");
showOn string <optional>
When the timepicker should be shown.

Possible values are
  • "focus" - when the element receives focus or when the trigger clock image is clicked. When the picker is closed, the field regains focus and is editable.
  • "image" - when the trigger clock image is clicked

Example to initialize the inputTime with showOn option specified $(".selector").ojInputDateTime("option", "timePicker.showOn", "focus");

Source:

title :string|undefined

Represents advisory information for the component, such as would be appropriate for a tooltip.

When a title is present it is by default displayed in the notewindow, or as determined by the 'title' property set on the displayOptions option. When the title option changes the component refreshes to display the new title.

JET takes the title attribute off the input and creates a notewindow with the title text. The HTML title attribute only shows up on mouse blur, not on keyboard and not in a mobile device. So title would only be for text that is not important enough to show all users, or for text that you show the users in another way as well, like in the label. Also you cannot theme the native browser's title window like you can the JET notewindow, so low vision users may have a hard time seeing it. For these reasons, the JET EditableValue components do not use the HTML's title attribute.

To include formatted text in the title, format the string using html tags. For example the title might look like:

<html>Enter <b>at least</b> 6 characters</html>
If you use formatted text, it should be accessible and make sense to the user if formatting wasn't there.
Default Value:
  • when the option is not set, the element's title attribute is used as its initial value if it exists.
Inherited From:
Source:
Examples

Initialize the component with the title option:

<!-- Foo is InputText, InputNumber, Select, etc. -->
<input id="username" type="text" data-bind="
   ojComponent: {component: 'ojFoo', title : 'enter at least 3 alphanumeric characters', 
                 pattern: '[a-zA-Z0-9]{3,}', value: ''}"/>

Initialize title option from html attribute 'title':

<!-- Foo is InputText, InputNumber, Select, etc. -->
<input id="username" type="text" value= "foobar" title="enter at least 3 alphanumeric characters" 
          pattern="[a-zA-Z0-9]{3,}"/>
$("#username").ojFoo({}); // Foo is InputText, InputNumber, Select, etc. // reading the title option will return "enter at least 3 alphanumeric characters" $("#username").ojFoo("option", "title"); // Foo is InputText, InputNumber, Select, etc.

translations :Object

A collection of translated resources from the translation bundle, or null if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.

If this component has (or inherits) translations, their documentation immediately follows this doc entry.

Default Value:
  • an object containing all resources relevant to the component and all its superclasses, or null if none
Inherited From:
Source:
Examples

Initialize the component, overriding some translated resources. This syntax leaves the other translations intact at create time, but not if called after create time:

// Foo is InputDate, InputNumber, etc.
$( ".selector" ).ojFoo({ "translations": { someKey: "someValue",
                                           someOtherKey: "someOtherValue" } });

Get or set the translations option, after initialization:

// Get one.  (Foo is InputDate, InputNumber, etc.)
var value = $( ".selector" ).ojFoo( "option", "translations.someResourceKey" );

// Get all.  (Foo is InputDate, InputNumber, etc.)
var values = $( ".selector" ).ojFoo( "option", "translations" );

// Set one, leaving the others intact.  (Foo is InputDate, InputNumber, etc.)
$( ".selector" ).ojFoo( "option", "translations.someResourceKey", "someValue" );

// Set many.  Any existing resource keys not listed are lost.  (Foo is InputDate, InputNumber, etc.)
$( ".selector" ).ojFoo( "option", "translations", { someKey: "someValue",
                                                    someOtherKey: "someOtherValue" } );

translations.cancel :string

The text to display for the Cancel link.

See the translations option for usage examples.

Default Value:
  • "Cancel"
Since:
  • 0.7
Source:

translations.currentText :string

The text to display for the current day link.

See the translations option for usage examples.

Default Value:
  • "Today"
Since:
  • 0.7
Inherited From:
Source:

translations.dateRestriction :Object

Provides properties to customize the hint and message text used by the implicit date restriction validator associated to the ojInputDateTime and ojInputDate components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.dateRestriction.hint :string

Hint text used by the implicit date restriction validator associated to the ojInputDateTime and ojInputDate components.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateRestriction.messageDetail :string

Message detail for the implicit date restriction validator associated to the ojInputDateTime and ojInputDate components.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateRestriction.messageSummary :string

Message summary for the implicit date restriction validator associated to the ojInputDateTime and ojInputDate components.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange :Object

Provides properties to customize the hint and message text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.dateTimeRange.hint :Object

Provides properties to customize the hint text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.dateTimeRange.hint.inRange :string

Hint text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. hint.inRange is shown when both min and max are set, and is used to tell the user the allowed number range.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange.hint.max :string

Hint text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. hint.max is shown when max is set and min is not set, and is used to tell the user the allowed maximum.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange.hint.min :string

Hint text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. hint.min is shown when min is set and max is not set, and is used to tell the user the allowed minimum.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange.messageDetail :Object

Provides properties to customize the error message text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.dateTimeRange.messageDetail.rangeOverflow :string

Error message text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. messageDetail.rangeOverflow is shown when max is set, and the value is greater than the maximum.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange.messageDetail.rangeUnderflow :string

Error message text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. messageDetail.rangeUnderflow is shown when min is set, and the value is less than the minimum.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange.messageSummary :Object

Provides properties to customize the error message summary text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.dateTimeRange.messageSummary.rangeOverflow :string

Error message summary text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. messageSummary.rangeOverflow is shown when max is set, and the value is greater than the maximum.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.dateTimeRange.messageSummary.rangeUnderflow :string

Error message summary text used by the implicit datetime range validator associated to the ojInputDateTime, ojInputDate, and ojInputTime components. messageSummary.rangeUnderflow is shown when min is set, and the value is less than the minimum.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.done :string

The text to display for the switchers Done link.

See the translations option for usage examples.

Default Value:
  • "Done"
Since:
  • 0.7
Source:

translations.nextText :string

The text to display for the next month link.

See the translations option for usage examples.

Default Value:
  • "Next"
Since:
  • 0.7
Inherited From:
Source:

translations.prevText :string

The text to display for the previous month link.

See the translations option for usage examples.

Default Value:
  • "Prev"
Since:
  • 0.7
Inherited From:
Source:

translations.regexp :Object

Provides properties to customize the message text used by the implicit regexp validator associated to the ojInputText and ojTextArea components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.regexp.messageDetail :Object

Provides properties to customize the error message detail used by the implicit regexp validator associated to the ojInputText and ojTextArea components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.regexp.messageSummary :Object

Provides properties to customize the error message summary used by the implicit regexp validator associated to the ojInputText and ojTextArea components.

See the translations option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.required :Object

Provides properties to customize the summary, detail and hint text used by the implicit required validator associated to any editable component that supports the required option.

See the translations option and required option for usage examples.

Since:
  • 0.7
Inherited From:
Source:

translations.required.hint :string

Hint text used by required validation error.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.required.messageDetail :string

Message text that describes the details of the required validation error.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.required.messageSummary :string

Message text for summarizing a required validation error.

See the translations option for usage examples.

Default Value:
  • ""
Since:
  • 0.7
Inherited From:
Source:
See:

translations.tooltipCalendar :string

Tooltip text for the calendar icon.

See the translations option for usage examples.

Default Value:
  • "Select Date"
Inherited From:
Source:

translations.tooltipCalendarDisabled :string

Tooltip text for the calendar icon when the component is disabled.

See the translations option for usage examples.

Default Value:
  • "Select Date Disabled"
Inherited From:
Source:

translations.tooltipCalendarTime :string

Tooltip text for the calendar + time icon.

See the translations option for usage examples.

Default Value:
  • "Select Date Time"
Inherited From:
Source:

translations.tooltipCalendarTimeDisabled :string

Tooltip text for the calendar + time icon when the component is disabled.

See the translations option for usage examples.

Default Value:
  • "Select Date Time Disabled"
Inherited From:
Source:

translations.weekHeader :string

The text to display for the week of the year column heading.

See the translations option for usage examples.

Default Value:
  • "Wk"
Since:
  • 0.7
Inherited From:
Source:

validators :Array|undefined

List of validators used by component when performing validation. Each item is either an instance that duck types oj.Validator, or is an Object literal containing the properties listed below. Implicit validators created by a component when certain options are present (e.g. required option), are separate from validators specified through this option. At runtime when the component runs validation, it combines the implicit validators with the list specified through this option.

Hints exposed by validators are shown in the notewindow by default, or as determined by the 'validatorHint' property set on the displayOptions option.

When validators option changes due to programmatic intervention, the component may decide to clear messages and run validation, based on the current state it is in.

Steps Performed Always

  • The cached list of validator instances are cleared and new validator hints is pushed to messaging. E.g., notewindow displays the new hint(s).

Running Validation

  • if component is valid when validators changes, component does nothing other than the steps it always performs.
  • if component is invalid and is showing messages - messagesShown option is non-empty, when validators changes then all component messages are cleared and full validation run using the display value on the component.
    • if there are validation errors, then value option is not updated and the error pushed to messagesShown option.
    • if no errors result from the validation, the value option is updated; page author can listen to the optionChange event on the value option to clear custom errors.
  • if component is invalid and has deferred messages when validators changes, it does nothing other than the steps it performs always.

Clearing Messages

  • Only messages created by the component are cleared. These include ones in messagesHidden and messagesShown options.
  • messagesCustom option is not cleared.

Properties:
Name Type Argument Description
type string the validator type that has a oj.ValidatorFactory that can be retrieved using the oj.Validation module. For a list of supported validators refer to oj.ValidatorFactory.
options Object <optional>
optional Object literal of options that the validator expects.
Source:
Examples

Initialize the component with validator object literal:

$(".selector").ojInputDateTime({
  validators: [{
    type: 'dateTimeRange', 
    options : {
      max: '2014-09-10T13:30:00.000',
      min: '2014-09-01T00:00:00.000'
    }
  }],
});

NOTE: oj.Validation.validatorFactory('dateTimeRange') returns the validator factory that is used 
to instantiate a range validator for dateTime.

Initialize the component with multiple validator instances:

var validator1 = new MyCustomValidator({'foo': 'A'}); 
var validator2 = new MyCustomValidator({'foo': 'B'});
// Foo is InputText, InputNumber, Select, etc.
$(".selector").ojFoo({
  value: 10, 
  validators: [validator1, validator2]
});

value

The value of the ojInputDateTime component which should be an ISOString
Default Value:
  • When the option is not set, the element's value property is used as its initial value if it exists. This value must be an ISOString.
Source:
Examples

Initialize the component with the value option:

<input id="date" data-bind="ojComponent: {component: 'ojInputDateTime', value: '2014-09-10T13:30:00.000'}" />

Initialize the component with the value option specified programmatically using oj.IntlConverterUtils.dateToLocalIso :

$(".selector").ojInputDateTime({'value': oj.IntlConverterUtils.dateToLocalIso(new Date())});

Get or set the value option, after initialization:

// Getter: returns Today's date in ISOString
$(".selector").ojInputDateTime("option", "value");
// Setter: sets it to a different date time
$(".selector").ojInputDateTime("option", "value", "2013-12-01T20:00:00-08:00");

Non-public Fields

Note: Extending JET components is not currently supported. Thus, non-public fields are for internal use only.

<protected> _AfterSetOptionConverter

Performs post processing after converter option changes by taking the following steps. - always push new converter hint to messaging
- if component has no errors -> refresh UI value
- if component is invalid has messagesShown -> clear all component errors and run full validation using display value.
  - if there are validation errors, value is not pushed to model; messagesShown is updated.
  - if no errors result from the validation, push value to model; author needs to listen to optionChange(value) to clear custom errors.
- if component is invalid has messagesHidden -> refresh UI value. no need to run deferred validations.
- messagesCustom is never cleared
Inherited From:
Source:

<protected> _AfterSetOptionRequired

Performs post processing after required option is set by taking the following steps. - if component is invalid and has messgesShown -> required: false/true -> clear component errors; run full validation with UI value (we don't know if the UI error is from a required validator or something else);
  - if there are validation errors, then value not pushed to model; messagesShown is updated
  - if no errors result from the validation, push value to model; author needs to listen to optionChange(value) to clear custom errors.
- if component is invalid and has messagesHidden -> required: false -> clear component errors; no deferred validation is run.
- if component has no error -> required: true -> run deferred validation (we don't want to flag errors unnecessarily)
- messagesCustom is never cleared
Inherited From:
Source:

<protected> _AfterSetOptionValidators

When validators option changes, take the following steps. - Clear the cached normalized list of all validator instances. push new hints to messaging.
- if component is valid -> validators changes -> no change
- if component is invalid has messagesShown -> validators changes -> clear all component messages and re-run full validation on displayValue. if there are no errors push value to model;
- if component is invalid has messagesHidden -> validators changes -> do nothing; doesn't change the required-ness of component
- messagesCustom is not cleared.
NOTE: The behavior applies to any option that creates implicit validators - min, max, pattern, etc. Components can call this method when these options change.
Inherited From:
Source:

<protected> _GetNormalizedValidatorsFromOption

This returns an array of all validators normalized from the validators option set on the component.
Inherited From:
Source:

<protected> _ResetConverter

Clears the cached converter stored in _converter and pushes new converter hint to messaging. Called when convterer option changes
Inherited From:
Source:

Binding Attributes

Binding attributes are similar to component options, but are exposed only via the ojComponent binding.

invalidComponentTracker :oj.InvalidComponentTracker

When this attribute is bound to an observable, the framework pushes an object of type oj.InvalidComponentTracker onto the observable. The object itself tracks the validity of a group of editable components.

When this attribute is present, the binding registers a listener for the optionChange event. This event is fired by JET editable components whenever its validity changes (i.e. when messagesShown or messagesHidden options change). When the event is fired, the listener determines the current validity of the component and updates the tracker.

The observable bound to this attribute is often used with multiple component binding declarations as shown in the example below.

This attribute is only exposed via the ojComponent binding, and is not a component option.

Default Value:
  • null
Since:
  • 0.7
Inherited From:
Source:
Examples

Track validity of multiple components using a single observable bound to the invalidComponentTracker attribute:

<input id="username" type="text" name="username" required 
  data-bind="ojComponent: {component: 'ojInputText', value: userName, 
                           invalidComponentTracker: tracker}">

<input id="password" type="password" name="password" required 
  data-bind="ojComponent: {component: 'ojInputPassword', value: password, 
                           invalidComponentTracker: tracker}"/>
  
// ViewModel that defines the tracker observable
<script>
function MemberViewModel() 
{ 
  var self = this;
  
  self.tracker = ko.observable();
  
  self.userName = ko.observable();   
  self.password = ko.observable();
  
  self.focusOnFirstInvalid = function() 
  {
     var trackerObj = ko.utils.unwrapObservable(self.tracker);
     if (trackerObj !== undefined)
     {
       // make sure the trackerObj is an oj.InvalidComponentTracker 
       // before calling methods on it.
       if (trackerObj instanceof oj.InvalidComponentTracker)
       {
          // showMessages first
          // (this will show any hidden messages, if any)
          trackerObj.showMessages();
          // focusOnFirstInvalid will focus on the first component
          // that is invalid, if any.      
          trackerObj.focusOnFirstInvalid();
        }
      }
    }
}
</script>

Use tracker property invalid to disable button:

// button is disabled if there are components currently showing errors
<button type="button" data-bind="ojComponent: {component: 'ojButton', label: 'Submit',
                                               disabled: tracker()['invalidShown']}">

Sub-ID's

Each subId locator object contains, at minimum, a subId property, whose value is a string that identifies a particular DOM node in this component. It can have additional properties to further specify the desired node. See getNodeBySubId and getSubIdByNode methods for more details.

Properties:
Name Type Description
subId string Sub-id string to identify a particular dom node.

Following are the valid subIds:

oj-datepicker-content

Sub-ID for the calendar drop down node.

Inherited From:
Source:
Example

Get the calendar drop down node:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-datepicker-content'} );

oj-datepicker-current

Sub-ID for the current/today button for button bar.

Inherited From:
Source:
Example

Get the current/today button for button bar:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-datepicker-current'} );

oj-datepicker-month

Sub-ID for the month span or select element.

Inherited From:
Source:
Example

Get the month span or select element:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-datepicker-month'} );

oj-datepicker-next-icon

Sub-ID for the next month icon.

Inherited From:
Source:
Example

Get the next month icon:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-datepicker-next-icon'} );

oj-datepicker-prev-icon

Sub-ID for the previous month icon.

Inherited From:
Source:
Example

Get the previous month icon:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-datepicker-prev-icon'} );

oj-datepicker-year

Sub-ID for the year span or select element.

Inherited From:
Source:
Example

Get the year span or select element:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-datepicker-year'} );

oj-inputdatetime-calendar-clock-icon

Sub-ID for the icon that triggers the calendar display.

Source:
Example

Get the icon that triggers the calendar display:

// Foo is ojInputDateTime 
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-inputdatetime-calendar-clock-icon'} );

oj-inputdatetime-calendar-icon

Sub-ID for the calendar icon that triggers the calendar drop down.

Inherited From:
Source:
Example

Get the calendar icon that triggers the calendar drop down:

// Foo is ojInputDate or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-inputdatetime-calendar-icon'} );

oj-inputdatetime-date-input

Sub-ID for the ojInputDate and ojInputDateTime component's input element. Note that if component is inline for ojInputDate it would return null whereas ojInputDateTime would return the input element of the internally created ojInputTime component.

Inherited From:
Source:
Example

Get the node for the input element:

var node = $( ".selector" ).ojInputDate( "getNodeBySubId", {'subId': 'oj-inputdatetime-date-input'} );

oj-inputdatetime-time-input

Sub-ID for the ojInputDateTime component's input element when not inline.

Source:
Example

Get the node for the input element:

var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-inputdatetime-time-input'} );

oj-timepicker-cancel-button

Sub-ID for the cancel button.

Source:
Example

Get the cancel button:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-cancel-button'} );

oj-timepicker-content

Sub-ID for the time wheel picker drop down node.

Source:
Example

Get the time wheel picker drop down node:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-content'} );

oj-timepicker-hour

Sub-ID for the hour picker.

Source:
Example

Get the hour picker:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-hour'} );

oj-timepicker-meridian

Sub-ID for the meridian picker.

Source:
Example

Get the meridian picker:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-meridian'} );

oj-timepicker-minute

Sub-ID for the minute picker.

Source:
Example

Get the minute picker:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-minute'} );

oj-timepicker-now

Sub-ID for the now button for button bar.

Source:
Example

Get the now/now button for button bar:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-now'} );

oj-timepicker-ok-button

Sub-ID for the OK button.

Source:
Example

Get the OK button:

// Foo is ojInputTime or ojInputDateTime.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-timepicker-ok-button'} );

Events

create

Triggered when the ojInputDateTime is created.
Properties:
Name Type Description
event Event jQuery event object
ui Object Currently empty
Source:
Examples

Initialize the ojInputDateTime with the create callback specified:

$( ".selector" ).ojInputDateTime({
    "create": function( event, ui ) {}
});

Bind an event listener to the ojcreate event:

$( ".selector" ).on( "ojcreate", function( event, ui ) {} );

destroy

Triggered before the component is destroyed. This event cannot be canceled; the component will always be destroyed regardless.

Inherited From:
Source:
Examples

Initialize component with the destroy callback

// Foo is Button, InputText, etc.
$(".selector").ojFoo({
  'destroy': function (event, data) {}
});

Bind an event listener to the destroy event

$(".selector").on({
  'ojdestroy': function (event, data) {
      // verify that the component firing the event is a component of interest
      if ($(event.target).is(".mySelector")) {
          window.console.log("The DOM node id for the destroyed component is : %s", event.target.id);
      }
  };
});

optionChange

Fired whenever a supported component option changes, whether due to user interaction or programmatic intervention. If the new value is the same as the previous value, no event will be fired. The event listener will receive two parameters described below:
Properties:
Name Type Description
event Event jQuery event object
ui Object event payload
Properties
Name Type Argument Description
option string the name of the option that changed.
previousValue Object an Object holding the previous value of the option. When previousValue is not a primitive type, i.e., is an Object, it may hold the same value as the value property.
value Object an Object holding the current value of the option.
subproperty Object <nullable>
an Object holding information about the subproperty that changed.
Properties
Name Type Description
path string the subproperty path that changed.
previousValue Object an Object holding the previous value of the subproperty.
value Object an Object holding the current value of the subproperty.
optionMetadata Object information about the option that changed
Properties
Name Type Description
writeback string "shouldWrite" or "shouldNotWrite". For use by the JET writeback mechanism; 'shouldWrite' indicates that the value should be written to the observable.
Inherited From:
Source:
Examples

Initialize component with the optionChange callback

// Foo is Button, InputText, etc.
$(".selector").ojFoo({
  'optionChange': function (event, ui) {}
});

Bind an event listener to the ojoptionchange event

$(".selector").on({
  'ojoptionchange': function (event, ui) {
      // verify that the component firing the event is a component of interest
      if ($(event.target).is(".mySelector")) {
          window.console.log("option that changed is: " + ui['option']);
      }
  };
});

Methods

getNodeBySubId(locator) → {Element|null}

Returns the component DOM node indicated by the locator parameter.

If the locator or its subId is null, then this method returns the element on which this component was initialized.

If a non-null subId is provided but no corresponding node can be located, then this method returns null.

This method is intended for use in test automation only, and should not be used in a production environment.

Parameters:
Name Type Description
locator Object An Object containing, at minimum, a subId property, whose value is a string that identifies a particular DOM node in this component.

If this component has (or inherits) any subIds, then they are documented in the Sub-ID's section of this document.

Some components may support additional fields of the locator Object, to further specify the desired node.

Inherited From:
Source:
Returns:
The DOM node located by the locator, or null if none is found.
Type
Element | null
Example

Get the node for a certain subId:

// Foo is ojInputNumber, ojInputDate, etc.
var node = $( ".selector" ).ojFoo( "getNodeBySubId", {'subId': 'oj-some-sub-id'} );

getSubIdByNode(node) → {Object|null}

Returns the subId string for the given DOM node in this component. For details, see getNodeBySubId and the Sub-ID's section of this document.

This method is intended for use in test automation only, and should not be used in a production environment.

Parameters:
Name Type Description
node Element DOM node in this component
Inherited From:
Source:
Returns:
The subId for the DOM node, or null if none is found.
Type
Object | null
Example

Get the subId for a certain DOM node:

// Foo is ojInputNumber, ojInputDate, etc.
var locator = $( ".selector" ).ojFoo( "getSubIdByNode", nodeInsideComponent );

#hide()

Hides the datepicker. Note that this function is a no-op when renderMode is 'native'.
Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

#hideTimePicker()

Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

isValid() → {boolean}

whether the component is currently valid. It is valid if it doesn't have any errors.
Inherited From:
Source:
Returns:
Type
boolean
Example

Check whether the component is valid:

var value = $(".selector").ojInputText("isValid");

option(optionName, value) → {Object|undefined}

This method has several overloads, which get and set component options and their fields. The functionality is unchanged from that provided by JQUI. See the examples for details on each overload.

Parameters:
Name Type Argument Description
optionName string | Object <optional>
the option name (string, first two overloads), or the map (Object, last overload). Omitted in the third overload.
value Object <optional>
a value to set for the option. Second overload only.
Inherited From:
Source:
Returns:
The getter overloads return the retrieved value(s). When called via the public jQuery syntax, the setter overloads return the object on which they were called, to facilitate method chaining.
Type
Object | undefined
Examples

First overload: get one option:

This overload accepts a (possibly dot-separated) optionName param as a string, and returns the current value of that option.

var isDisabled = $( ".selector" ).ojFoo( "option", "disabled" ); // Foo is Button, Menu, etc.

// For object-valued options, dot notation can be used to get the value of a field or nested field.
var startIcon = $( ".selector" ).ojButton( "option", "icons.start" ); // icons is object with "start" field

Second overload: set one option:

This overload accepts two params: a (possibly dot-separated) optionName string, and a new value to which that option will be set.

$( ".selector" ).ojFoo( "option", "disabled", true ); // Foo is Button, Menu, etc.

// For object-valued options, dot notation can be used to set the value
// of a field or nested field, without altering the rest of the object.
$( ".selector" ).ojButton( "option", "icons.start", myStartIcon ); // icons is object with "start" field

Third overload: get all options:

This overload accepts no params, and returns a map of key/value pairs representing all the component options and their values.

var options = $( ".selector" ).ojFoo( "option" ); // Foo is Button, Menu, etc.

Fourth overload: set one or more options:

This overload accepts a single map of option-value pairs to set on the component. Unlike the first two overloads, dot notation cannot be used.

$( ".selector" ).ojFoo( "option", { disabled: true, bar: 42 } ); // Foo is Button, Menu, etc.

reset()

Resets the component by clearing all messages options - messagesCustom, messagesHidden and messagesShown, and updates the component's display value using the option value. User entered values will be erased when this method is called.
Since:
  • 0.7
Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.
Example

Reset component

$(selector).ojInputText("reset"); 

#show()

Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

showMessages()

Takes all hidden messages that are in the messagesHidden option and moves them to messagesShown option. If there were no messages in messagesHidden then this method simply returns.

To view messages user has to set focus on the component.

An optionChange event is triggered on both messagesHidden and messagesShown options.

Since:
  • 0.7
Inherited From:
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.
Example

Display all messages including deferred ones.

$(selector).ojInputText("showMessages");

#showTimePicker()

Method to show the internally created ojInputTime
Source:
Returns:
When called via the public jQuery syntax, this method returns the object on which it was called, to facilitate method chaining.

#validate() → {boolean}

Validates the component's display value using the converter and all validators registered on the component and updates the value option by performing the following steps.

  1. All messages are cleared, including custom messages added by the app.
  2. If no converter is present then processing continues to next step. If a converter is present, the UI value is first converted (i.e., parsed). If there is a parse error then the messagesShown option is updated and method returns false.
  3. If there are no validators setup for the component the value option is updated using the display value and the method returns true. Otherwise all validators are run in sequence using the parsed value from the previous step. The implicit required validator is run first if the component is marked required. When a validation error is encountered it is remembered and the next validator in the sequence is run.
  4. At the end of validation if there are errors, the messagesShown option is updated and method returns false. If there were no errors, then the value option is updated and method returns true.
Since:
  • 0.7
Inherited From:
Source:
Returns:
true if component passed validation, false if there were validation errors.
Type
boolean
Example

Validate component using its current value.

// validate display value. 
$(.selector).ojInputText('validate');

#widget() → {jQuery}

Returns a jQuery object containing the element visually representing the component, excluding the label associated with the it.

This method does not accept any arguments.

Inherited From:
Source:
Returns:
the root of the component
Type
jQuery
Example

Invoke the widget method:

var widget = $( ".selector" ).ojFoo( "widget" ); // Foo is InputText, InputPassword, TextArea

Non-public Methods

Note: Extending JET components is not currently supported. Thus, non-public methods are for internal use only.

<protected> _AddActiveable(options)

Add touch and mouse listeners to toggle oj-active class
Parameters:
Name Type Description
options !Object | !jQuery This parameter can either be the element (convenience syntax for callers needing to specify only the element(s) that would otherwise have been passed as options.element) or an object supporting the following fields:
Properties
Name Type Argument Description
element jQuery The element(s) to receive the oj-active class on active Required if afterToggle is specified.
afterToggle function(string) <nullable>
Optional callback function called each time the active classes have been toggled, after the toggle. The event.type string is passed and indicates whether the classes were added or removed. The active classes are added on "touchstart" or "mousedown" or "mouseenter" and the active classes are removed on "touchend" or "touchcancel" or "mouseup" or "mouseleave". Components with consistency requirements, such as "oj-default must be applied iff no state classes such as oj-active are applied," can enforce those rules in this callback.
Inherited From:
Source:
See:

<protected> _AddHoverable(options)

Add mouse listners to toggle oj-hover class
Parameters:
Name Type Description
options !Object | !jQuery This param can either be the element (convenience syntax for callers needing to specify only the element(s) that would otherwise have been passed as options.element) or an object supporting the following fields:
Properties
Name Type Argument Description
element jQuery The element(s) to receive the oj-hover class on hover Required if afterToggle is specified.
afterToggle function(string) <nullable>
Optional callback function called each time the hover classes have been toggled, after the toggle. The string "mouseenter" or "mouseleave" is passed, indicating whether the classes were added or removed. Components with consistency requirements, such as "oj-default must be applied iff no state classes such as oj-hover are applied," can enforce those rules in this callback.
Inherited From:
Source:
See:

<protected> #_AfterCreate()

Source:

<protected> _AfterCreateEvent()

This method is called after the create event is fired. Components usually should not override this method, as it is rarely correct to wait until after the create event to perform a create-time task.

An example of a correct usage of this method is Dialog's auto-open behavior, which needs to happen after the create event.

Only behaviors (like Dialog auto-open behavior) should occur in this method. Component initialization must occur earlier, before the create event is fired, so that create listeners see a fully inited component.

Overrides of this method should call this._super first.

Do not confuse this method with the _AfterCreate method, which is more commonly used.

Inherited From:
Source:

<protected> #_AfterSetOption(option, previous, flags)

Performs post processing after _SetOption() is called. Different options when changed perform different tasks. See _AfterSetOption[OptionName] method for details.
Parameters:
Name Type Argument Description
option string
previous Object | string <optional>
flags Object <optional>
Inherited From:
Source:

<protected> _AfterSetOptionDisabledReadOnly(option, validationOptions)

Performs post processing after disabled or readOnly option changes by taking the following steps. (Steps are same for readOnly option).

if disabled component is enabled then,
- if there are no errors, run deferred validation. component could have been initialized with empty value and disabled.
- if component is invalid and showing messages clear component error, grab UI value and run full validation.
- if component is invalid and has hidden messages; do nothing.

if enabled component is disabled no validation is run.

Parameters:
Name Type Description
option String
validationOptions Object
Inherited From:
Source:

<protected> _AfterSetOptionValue(option, flags)

Performs post processing after value option changes by taking the following steps. - triggers an optionChange and does writeback if required.
- if setOption was from programmatic intervention,
  - clear custom messages and component messages;
  - run deferred validation. if there is an error, updates messagesHidden.
- always refreshes UI display
Parameters:
Name Type Argument Description
option string
flags Object <optional>
Inherited From:
Source:

<protected> #_AriaRequiredUnsupported()

Called to find out if aria-required is unsupported.
Inherited From:
Source:

<protected> #_CanSetValue() → {boolean}

Whether the a value can be set on the component. For example, if the component is disabled or readOnly then setting value on component is a no-op.
Inherited From:
Source:
See:
Returns:
Type
boolean

<protected> _ClearPlaceholder()

Clear the placeholder option
Inherited From:
Source:

<protected> _CompareOptionValues(option, value1, value2) → {boolean}

Compares 2 option values for equality and returns true if they are equal; false otherwise.

Parameters:
Name Type Description
option String the name of the option
value1 Object first value
value2 Object another value
Inherited From:
Source:
Returns:
Type
boolean

<protected> #_ComponentCreate()

Source:

<protected> _create()

This method is final in JET. Components should instead override one or more of the overridable create-time methods listed in _ComponentCreate.

Inherited From:
Source:

<protected> _createDescribedByForLabel()

Refreshes the aria-describedby for label element's helpIcon
Inherited From:
Source:

<protected> _destroy()

Detaches the widget from the element and restores element exactly like it was before the widget was attached.
Inherited From:
Source:

<protected> _FixRendererContext(context) → {Object}

Prepares a custom renderer context object for either the JQuery or custom element syntax, removing and exposing keys as needed.
Parameters:
Name Type Description
context Object The renderer context object.
Inherited From:
Source:
Returns:
The cleaned up renderer context.
Type
Object

<protected> _focusable(options)

Sets JET's "focus" CSS classes when the element is focused and removes them when focus is lost.

The oj-focus class is set on all focuses.

Some components additionally have an oj-focus-highlight class, which applies a focus indicator that is appropriate on a subset of the occasions that oj-focus is appropriate. Those components should pass true for the applyHighlight param, in which case the oj-focus-highlight class is set if appropriate given the current focus highlight policy.

Focus highlight policy

The focus highlight policy supports the 3 values listed below. By default, it is retrieved from the $focusHighlightPolicy SASS variable, shared by many components and patterns. Components with different needs, including those exposing a component-specific SASS variable or other API for this, should see the getFocusHighlightPolicy parameter below. Valid focus highlight policies:

Policy Description
"nonPointer" Indicates that the component should apply the oj-focus-highlight class only for focuses not resulting from pointer (touch or mouse) interaction. (In the built-in themes, the SASS variable defaults to this value.)
"all" Indicates that the component should apply the class for all focuses.
"none" Indicates that the component should never apply the class, because the application has taken responsibility for applying the class when needed for accessibility.
Toggling the classes

Components that toggle these focus classes outside of this API must maintain the invariant that oj-focus-highlight is applied to a given element in a (not necessarily strict) subset of cases that oj-focus is applied to that element.

Typically the specified element should be within the component subtree, in which case the classes will automatically be removed from the element when the component is destroyed, when its disabled option is set to true, and when _NotifyDetached() is called.

As a minor exception, for components that wrap themselves in a new root node at create time, if the specified element is within the root node's subtree but not within the init node's subtree, then at destroy time only, the classes will not be removed, since destroy() is expected to remove such nodes.

If the element is NOT in the component subtree, then the caller is responsible for removing the classes at the times listed above.

Listeners

If setupHandlers is not passed, or if setupHandlers is passed and uses _on to register its listeners as seen in the example, then the listeners are not invoked when the component is disabled, and the listeners are automatically cleaned up when the component is destroyed. Otherwise, the caller is responsible for ensuring that the disabled state is handled correctly, and removing the listeners at destroy time.

Related API's

Non-component internal callers should see oj.DomUtils.makeFocusable(). Per its JSDoc (unpublished; see the source), it has a couple of additional usage considerations.

Parameters:
Name Type Description
options !Object | !jQuery This param can either be the element (convenience syntax for callers needing to specify only the element(s) that would otherwise have been passed as options.element) or an object supporting the following fields:
Properties
Name Type Argument Description
element jQuery The element(s) to receive the oj-focus classes on focus. Required if setupHandlers not passed; ignored otherwise.
applyHighlight boolean true if the oj-focus-highlight class should be applied when appropriate. false or omitted if that class should never be applied.
afterToggle function(string) <nullable>
Optional callback function called each time the focus classes have been toggled, after the toggle. The string "focusin" or "focusout" is passed, indicating whether the classes were added or removed. Components with consistency requirements, such as "oj-default must be applied iff no state classes such as oj-focus are applied," can enforce those rules in this callback.
getFocusHighlightPolicy function() <nullable>
Optional if applyHighlight is true; ignored otherwise. Components with a component-specific focus policy mechanism should pass a function that always returns one of the three valid values listed above, keeping in mind that this method can be called on every focus. See the example.
recentPointer function() <nullable>
Relevant iff applyHighlight is true and the focus highlight policy is "nonPointer"; ignored otherwise. Recent pointer activity is considered to have occurred if (a) a mouse button or finger has recently been down or up, or (b) this optional callback function returns true. Components wishing to additionally take into account (say) recent pointer movements can supply a function returning true if those movements have been detected, keeping in mind that this method can be called on every focus. See the example.
setupHandlers function(function(!jQuery),function(!jQuery)) <nullable>
Can be omitted by components whose focus classes need to be added and removed on focusin and focusout, respectively. Components needing to add/remove those classes in response to other events should specify this parameter, which is called once, immediately. See the examples.
Inherited From:
Source:
Examples

Opt into the highlight behavior, and specify a function to be called every time the classes are toggled:

var self = this;
this._focusable({
    'element': this.element, 
    'applyHighlight': true, 
    'afterToggle' : function() {
        self._toggleDefaultClasses();
    }
});

Arrange for mouse movement to be considered in addition to mouse/finger up/down. Also supply a component-specific focusHighlightPolicy:

var self = this;
this._focusable({
    'element': someElement, 
    'applyHighlight': true, 
    'recentPointer' : function() {
        // A timestamp-based approach avoids the risk of getting stuck in an inaccessible 
        // state if (say) mouseenter is not followed by mouseleave for some reason.
        var millisSincePointerMove = Date.now() - _myPointerMoveTimestamp;
        var isRecent = millisSincePointerMove < myThreshold;
        return isRecent;
    },
    'getFocusHighlightPolicy' : function() {
        // Return the value of a component-specific SASS $variable, component option, or other 
        // component-specific mechanism, either "all", "none", or "nonPointer".  SASS variables
        // should be pulled into JS once statically on load, not per-instance or per-focus.
    }
});

Add/remove the focus classes in response to events other than focusin/focusout:

var self = this;
this._focusable({
    'applyHighlight': myBooleanValue, 
    'setupHandlers': function( focusInHandler, focusOutHandler) {
        self._on( self.element, {
            // This example uses focus/blur listeners, which don't bubble, rather than the 
            // default focusin/focusout (which bubble).  This is useful when one focusable  
            // element is a descendant of another.
            focus: function( event ) {
                focusInHandler($( event.currentTarget ));
            },
            blur: function( event ) {
                focusOutHandler($( event.currentTarget ));
            }
        });
    }
});

Alternate usage of setupHandlers, which simply stashes the handlers so they can be called from the component's existing handlers:

var self = this;
this._focusable({
    'applyHighlight': myBooleanValue, 
    'setupHandlers': function( focusInHandler, focusOutHandler) {
        self._focusInHandler = focusInHandler;
        self._focusOutHandler = focusOutHandler;
    }
});

<protected> _formatValue(value) → {string}

Formats the value for display, based on the converter options. If no converter is set then returns the value as is.
Parameters:
Name Type Description
value string value to be formatted
Inherited From:
Source:
Throws:
when an error occurs during formatting
Type
Error
Returns:
formatted value
Type
string

<protected> _GetAllValidators() → {Array}

Returns an array of all validators built by merging the validators option set on the component and the implicit validators setup by the component.
This does not include the implicit required validator. Components can override to add to this array of validators.
Inherited From:
Source:
Returns:
of validators
Type
Array

<protected> _GetContentElement() → {jQuery}

Returns a jquery object of the element representing the content node. This could be a jQuery object of the element the widget was invoked on - typically this is an input or select or textarea element for which a value can be set.
Inherited From:
Source:
Returns:
the jquery element that represents the editable content. E.g., an input
Type
jQuery

<protected> #_GetConverter() → {Object}

Need to override since apparently we allow users to set the converter to null, undefined, and etc and when they do we use the default converter
Source:
Returns:
a converter instance or null
Type
Object

<protected> _getCreateOptions()

This method is not used in JET. Components should instead override _InitOptions.

Inherited From:
Source:

<protected> #_GetDefaultStyleClass() → {string}

Source:
Returns:
Type
string

<protected> _GetDisplayValue(value) → {string}

Returns the display value that is ready to be passed to the converter.
Parameters:
Name Type Description
value Object the stored value if available that needs to be formatted for display
Inherited From:
Source:
Returns:
usually a string display value
Type
string

<protected> _GetEventForSyntax(event) → {Object}

Given an event, returns the appropriate event for the component syntax. For custom elements, if the event is a JQuery event, this method will return the unwrapped original event.
Parameters:
Name Type Description
event Object [description]
Inherited From:
Source:
Returns:
Type
Object

<protected> _GetLabelElement() → {Object}

Returns a jquery object of the element(s) representing the label node(s) for the input component. First we look for the aria-labelledby attribute on the input. If that's not found, we look for the label with 'for' attribute pointing to input. If that's not found, we walk up the dom looking for aria-labelledby. Note: multiple labels for one input is legal in html-5.
Inherited From:
Source:
Returns:
the jquery element that represents the input component's label. return null if it can't find anything.
Type
Object

<protected> #_GetMessagingLauncherElement() → {Object}

Source:
Returns:
jquery object
Type
Object

<protected> _GetReadingDirection() → {string}

Determines whether the component is LTR or RTL.

Component responsibilities:

  • All components must determine directionality exclusively by calling this protected superclass method. (So that any future updates to the logic can be made in this one place.)
  • Components that need to know the directionality must call this method at create-time and from refresh(), and cache the value.
  • Components should not call this at other times, and should instead use the cached value. (This avoids constant DOM queries, and avoids any future issues with component reparenting (i.e. popups) if support for directional islands is added.)

App responsibilities:

  • The app specifies directionality by setting the HTML "dir" attribute on the <html> node. When omitted, the default is "ltr". (Per-component directionality / directional islands are not currently supported due to inadequate CSS support.)
  • As with any DOM change, the app must refresh() the component if the directionality changes dynamically. (This provides a hook for component housekeeping, and allows caching.)
Default Value:
  • "ltr"
Inherited From:
Source:
Returns:
the reading direction, either "ltr" or "rtl"
Type
string

<protected> _GetSavedAttributes(element) → {Object|null}

Gets the saved attributes for the provided element.

If you don't override _SaveAttributes and _RestoreAttributes, then this will return null.

If you override _SaveAttributes to call _SaveAllAttributes, then this will return all the attributes. If you override _SaveAttributes/_RestoreAttributes to do your own thing, then you may also have to override _GetSavedAttributes to return whatever you saved if you need access to the saved attributes.

Parameters:
Name Type Description
element Object jQuery selection, should be a single entry
Inherited From:
Source:
Returns:
savedAttributes - attributes that were saved for this element in _SaveAttributes, or null if none were saved.
Type
Object | null

<protected> #_GetTranslationsSectionName()

Source:

<protected> _HandleChangeEvent(event)

Convenience handler for the DOM 'change' event. Subclasses are expected to wire up event handlers for DOM events that they wish to handle.
The implementation retrieves the display value for the component by calling _GetDisplayValue() and calls _SetValue(), with full validation.
Parameters:
Name Type Description
event Event DOM event
Inherited From:
Source:

<protected> _HasPlaceholderSet()

whether the placeholder option is set
Inherited From:
Source:

<protected> _init()

JET components should almost never implement this JQUI method. Please consult an architect if you believe you have an exception. Reasons:

  • This method is called at create time, after the create event is fired. It is rare for that to be the appropriate time to perform a create-time task. For those rare cases, we have the _AfterCreateEvent method, which is preferred over this method since it is called only at that time, not also at re-init time (see next).
  • This method is also called at "re-init" time, i.e. when the initializer is called after the component has already been created. JET has not yet identified any desired semantics for re-initing a component.
Inherited From:
Source:

<protected> #_InitOptions()

Inherited From:
Source:

<protected> _IsCustomElement() → {boolean}

Determines whether the component is being rendered as a custom element.
Inherited From:
Source:
Returns:
True if the component is being rendered as a custom element
Type
boolean

<protected> _IsEffectivelyDisabled() → {boolean}

Determines whether this component is effectively disabled, i.e. it has its 'disabled' attribute set to true or it has been disabled by its ancestor component.

Inherited From:
Source:
Returns:
true if the component has been effectively disabled, false otherwise
Type
boolean

<protected> #_IsRequired() → {boolean}

Whether the component is required.
Inherited From:
Source:
Returns:
true if required; false
Type
boolean

<protected> _NotifyAttached()

Notifies the component that its subtree has been connected to the document programmatically after the component has been created.

Inherited From:
Source:

<protected> _NotifyContextMenuGesture(menu, event, eventType)

When the contextMenu option is set, this method is called when the user invokes the context menu via the default gestures: right-click, Press & Hold, and Shift-F10. Components should not call this method directly.

The default implementation simply calls this._OpenContextMenu(event, eventType). Overrides of this method should call that same method, perhaps with additional params, not menu.open().

This method may be overridden by components needing to do things like the following:

  • Customize the launcher or position passed to _OpenContextMenu(). See that method for guidance on these customizations.
  • Customize the menu contents. E.g. some components need to enable/disable built-in commands like Cut and Paste, based on state at launch time.
  • Bail out in some cases. E.g. components with UX approval to use PressHoldRelease rather than Press & Hold can override this method to say if (eventType !== "touch") this._OpenContextMenu(event, eventType);. When those components detect the alternate context menu gesture (e.g. PressHoldRelease), that separate listener should call this._OpenContextMenu(), not this method (_NotifyContextMenuGesture()), and not menu.open().

Components needing to do per-launch setup like the above tasks should do so in an override of this method, not in a beforeOpen listener or an _OpenContextMenu() override. This is discussed more fully here.

Parameters:
Name Type Description
menu Object The JET Menu to open as a context menu. Always non-null.
event Event What triggered the menu launch. Always non-null.
eventType string "mouse", "touch", or "keyboard". Never null.
Inherited From:
Source:

<protected> #_NotifyDetached()

Notifies the component that its subtree has been removed from the document programmatically after the component has been created
Source:

<protected> #_NotifyHidden()

Notifies the component that its subtree has been made hidden programmatically after the component has been created
Source:

<protected> _NotifyShown()

Notifies the component that its subtree has been made visible programmatically after the component has been created.

Inherited From:
Source:

<protected> #_OnDatePicked()

callback upon picking date from native picker
Source:

<protected> _OpenContextMenu(event, eventType, openOptions, submenuOpenOptions, shallow)

The only correct way for a component to open its context menu is by calling this method, not by calling Menu.open() or _NotifyContextMenuGesture(). This method should be called in two cases:

  • This method is called by _NotifyContextMenuGesture() and its overrides. That method is called when the baseComponent detects the default context menu gestures: right-click, Press & Hold, and Shift-F10.
  • Components with UX-approved support for alternate context menu gestures like PressHoldRelease should call this method directly when those gestures are detected.

Components needing to customize how the context menu is launched, or do any per-launch setup, should do so in the caller of this method, (which is one of the two callers listed above), often by customizing the params passed to this method (_OpenContextMenu) per the guidance below. This setup should not be done in the following ways:

  • Components should not perform setup in a beforeOpen listener, as this can cause a race condition where behavior depends on who got their listener registered first: the component or the app. The only correct component use of a beforeOpen listener is when there's a need to detect whether something else launched the menu.
  • Components should not override this method (_OpenContextMenu), as this method is final. Instead, customize the params that are passed to it.

Guidance on setting OpenOptions fields:

Launcher:

Depending on individual component needs, any focusable element within the component can be the appropriate launcher for this launch.

Browser focus returns to the launcher on menu dismissal, so the launcher must at least be focusable. Typically a tabbable (not just focusable) element is safer, since it just focuses something the user could have focused on their own.

By default (i.e. if openOptions is not passed, or if it lacks a launcher field), the component init node is used as the launcher for this launch. If that is not focusable or is suboptimal for a given component, that component should pass something else. E.g. components with a "roving tabstop" (like Toolbar) should typically choose the current tabstop as their launcher.

The :focusable and :tabbable selectors may come in handy for choosing a launcher, e.g. something like this.widget().find(".my-class:tabbable").first().

Position:

By default, this method applies positioning that differs from Menu's default in the following ways: (The specific settings are subject to change.)

  • For mouse and touch events, the menu is positioned relative to the event, not the launcher.
  • For touch events, "my" is set to "start>40 center", to avoid having the context menu obscured by the user's finger.

Usually, if position needs to be customized at all, the only thing that needs changing is its "of" field, and only for keyboard launches (since mouse/touch launches should almost certainly keep the default "event" positioning). This situation arises anytime the element relative to which the menu should be positioned for keyboard launches is different than the launcher element (the element to which focus should be returned upon dismissal). For this case, { "position": {"of": eventType==="keyboard" ? someElement : "event"} } can be passed as the openOptions param.

Be careful not to clobber useful defaults by specifying too much. E.g. if you only want to customize "of", don't pass other fields like "my", since your value will be used for all modalities (mouse, touch, keyboard), replacing the modality-specific defaults that are usually correct. Likewise, don't forget the eventType==="keyboard" check if you only want to customize "of" for keyboard launches.

InitialFocus:

This method forces initialFocus to "menu" for this launch, so the caller needn't specify it.

Parameters:
Name Type Argument Description
event Event What triggered the context menu launch. Must be non-null.
eventType string "mouse", "touch", or "keyboard". Must be non-null. Passed explicitly since caller knows what it's listening for, and since events like contextmenu and click can be generated by various input modalities, making it potentially error-prone for this method to determine how they were generated.
openOptions Object <optional>
Options to merge with this method's defaults, which are discussed above. The result will be passed to Menu.open(). May be null or omitted. See also the shallow param.
submenuOpenOptions Object <optional>
Options to be passed through to Menu.open(). May be null or omitted.
shallow boolean <optional>
Whether to perform a deep or shallow merge of openOptions with this method's default value. The default and most commonly correct / useful value is false.
  • If true, a shallow merge is performed, meaning that the caller's position object, if passed, will completely replace this method's default position object.
  • If false or omitted, a deep merge is performed. For example, if the caller wishes to tweak position.of while keeping this method's defaults for position.my, position.at, etc., it can pass {"of": anOfValue} as the position value.

The shallow param is n/a for submenuOpenOptions, since this method doesn't apply any defaults to that. (It's a direct pass-through.)

Inherited From:
Source:

<protected> _parseValue(submittedValue) → {Object}

Parses the value using the converter set and returns the parsed value. If parsing fails the error is written into the element
Parameters:
Name Type Argument Description
submittedValue string <optional>
to parse
Inherited From:
Source:
Throws:
an Object with message
Type
Error
Returns:
parsed value
Type
Object

<protected> _Refresh(name, value, forceDisplayValueRefresh)

Called in response to a change in the options set for this component, this method refreshes the component display value. Subclasses can override to provide custom refresh behavior.
Parameters:
Name Type Argument Description
name String <optional>
the name of the option that was changed
value Object <optional>
the current value of the option
forceDisplayValueRefresh boolean <optional>
Inherited From:
Source:

<protected> _ReleaseResources()

Release resources held by this component, for example, remove listeners. This is called during destroy. _SetupResources will set up resources needed by this component, and is called during _create.

This base class default implementation does nothing.

Component subclasses can opt in by overriding _SetupResources and _ReleaseResources.
Inherited From:
Source:

<protected> _RemoveActiveable(element)

Remove touch and mouse listeners that were registered in _AddActiveable
Parameters:
Name Type Description
element jQuery The same element passed to _AddActiveable
Inherited From:
Source:
See:

<protected> _RemoveHoverable(element)

Remove mouse listners that were registered in _AddHoverable
Parameters:
Name Type Description
element jQuery The same element passed to _AddHoverable
Inherited From:
Source:
See:

<protected> _ResetAllValidators()

EditableValue caches the validators to be run, within this._allValidators variable. This is great; however when the implicit validator needs to be reset [i.e. min + max changing] or the validators option changes, then the cached this._allValidators needs to be cleared. This method also updates the messaging strategies as hints associated with validators could have changed.
Inherited From:
Source:

<protected> _ResetComponentState()

Called anytime the label DOM changes requiring a reset of any dependent feature that caches the label, including all validators.
Inherited From:
Source:

<protected> _RestoreAllAttributes()

Restores all the element's attributes which were saved in _SaveAllAttributes. This method is final in JET.

If a subclass wants to save/restore all attributes on create/destroy, then the subclass can override _SaveAttributes and call _SaveAllAttributes and also override _RestoreAttributes and call _RestoreAllAttributes.

Inherited From:
Source:

<protected> _RestoreAttributes()

Inherited From:
Source:

<protected> _SaveAllAttributes(element)

Saves all the element's attributes within an internal variable. _RestoreAllAttributes will restore the attributes from this internal variable.

This method is final in JET. Subclasses can override _RestoreAttributes and call _RestoreAllAttributes.

The JSON variable will be held as:

[
  {
  "element" : element[i],
  "attributes" :
    {
      attributes[m]["name"] : {"attr": attributes[m]["value"]
    }
  }
]
Parameters:
Name Type Description
element Object jQuery selection to save attributes for
Inherited From:
Source:

<protected> #_SaveAttributes(element)

The base method needs to be overriden so that one can perform attribute check/set [i.e. ojInputText can only have type="text"]
Parameters:
Name Type Description
element Object jQuery selection to save attributes for
Inherited From:
Source:

<protected> _SetDisabledDom(node)

Sets the disabled option onto the dom. Component subclasses can override this method to not do this in cases where it is invalid, like on a div (e.g., radioset's root dom element is a div).
Parameters:
Name Type Description
node Object dom node
Since:
  • 1.0.0
Inherited From:
Source:

<protected> _setOption(name, value, flags)

Called (by the widget factory) when the option changes, this method responds to the change by refreshing the component if needed. This method is not called for the options passed in during the creation of the widget.
Parameters:
Name Type Description
name string of the option
value Object | string
flags Object? optional flags. The following flags are currently supported:
  • changed - true if the caller wants to indicate the value has changed, so no comparison is necessary
Inherited From:
Source:

<protected> _SetPlaceholder(value)

Sets the placeholder text on the content element by default. It sets the placeholder attribute on the element. Component subclasses can override this method to control where placeholder text gets set.
Parameters:
Name Type Description
value string
Inherited From:
Source:

<protected> _SetPlaceholderOption(value)

Sets the placeholder option with the value.
Parameters:
Name Type Description
value string
Inherited From:
Source:

<protected> _SetRawValue(val, event)

Convenience function to set the rawValue option. Called by subclasses
Parameters:
Name Type Description
val String value to set rawValue to
event Event DOM event
Inherited From:
Source:

<protected> _SetRootAttributes()

Reads the rootAttributes option, and sets the root attributes on the component's root DOM element. See rootAttributes for the set of supported attributes and how they are handled.

Inherited From:
Source:
Throws:
if unsupported attributes are supplied.

<protected> _SetupResources()

Sets up needed resources for this component, for example, add listeners. This is called during _create. _ReleaseResources will release resources help by this component, and is called during destroy.

This base class default implementation does nothing.

Component subclasses can opt in by overriding _SetupResources and _ReleaseResources.
Inherited From:
Source:

<protected> #_ShowNativeDatePicker()

Shows the native datepicker
Source:

<protected> _UnregisterChildNode()

Remove all listener references that were attached to the element.
Inherited From:
Source:

<protected> _Validate(newValue, event, options) → {Object|string|undefined}

Runs full validation on the value. If value fails basic checks (see _CanSetValue, or if value failed validation, this method returns false. Otherwise it returns true.

Components should call this method if they know UI value has changed and want to set the new component value.

Parameters:
Name Type Argument Description
newValue string | Object the actual value to be set. Usually this is the string display value
event Object <optional>
an optional event if this was a result of ui interaction. For user initiated actions that trigger a DOM event, passing this event is required. E.g., if user action causes a 'blur' event.
options {doNotClearMessages:boolean,validationContext:number,validationMode:number} <optional>
an Object literal that callers pass in to determine how validation gets run.
Properties
Name Type Argument Description
doNotClearMessages boolean <optional>
if set method will not clear all messages. This is provided for callers that may want to clear only some of the messages. E.g., when required option changes, it clears only component messages, not custom.
validationContext number <optional>
the context this method was called. When not set it defaults to _VALIDATION_CONTEXT.USER_ACTION.
validationMode number <optional>
accepted values defined in _VALIDATION_MODE
Inherited From:
Source:
Returns:
the parsed value or undefined if validation failed
Type
Object | string | undefined

<protected> Focus() → {*}

Sets focus on the element that naturally gets focus. For example, this would be the input element for input type components.
Since:
  • 0.7
Inherited From:
Source:
Returns:
a truthy value if focus was set to the intended element, a falsey value otherwise.
Type
*