new RMP_TextInput(conf)
This constructor allows you to create an input widget that can be inserted dynamically in your web interface.
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | JSON structure which contains the configuration of the text, mail, date or number input |
Example
var inputConf = {
id: 'id_insertedInput',
label: 'Inserted Input',
variables: [{ id: 'variable', name: 'insertedInputVariable', value: 'foo' }],
};
var input = new RMP_TextInput(inputConf);
id_of_a_widget.insertAfter(input) // id_of_a_widget is the ID of a widget that already exists in the WI.
Methods
# inner isFollowKeyPressEnabled() → {boolean}
Returns true if the Keypress field is enabled, otherwise false.
boolean
# inner setCustomDateHandler(dateHandeler)
Adds a custom handler to compute the date selected or entered
by the end user before setting the variable of the Date input widget.
By default, the offset time is set to UTC 12:00. If a custom handler
is configured, it affects all the Date input widgets of the
web interface.
Parameters:
Name | Type | Description |
---|---|---|
dateHandeler |
customDateHandeler |
Example
RMP_TextInput.prototype.setCustomDateHandler(function(selectedDate){
var computedDate = new Date(selectedDate.getTime());
computedDate.setHours(12);
computedDate.setMinutes(0);
computedDate.setSeconds(0);
return computedDate;
})
# inner setDate(date)
Sets the date field (text) of the Date input widget.
Parameters:
Name | Type | Description |
---|---|---|
date |
string | Date to set |
# inner setFollowKeyPressEnabled(enabled)
Enables or disables the Keypress field.
Parameters:
Name | Type | Description |
---|---|---|
enabled |
boolean |
# inner setLoadFailCallback(callback)
Sets a callback that's called when there's an error in fetching autocomplete data.
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:RMP_TextInput~loadFailCallback |
# inner setLoadSuccessCallback(callback)
Sets a callback that's called whenever data is fetched and shown in the dropdown.
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:RMP_TextInput~loadSuccessCallback |
# inner setNumber(number)
Sets the number field (text) of the Number input widget.
Parameters:
Name | Type | Description |
---|---|---|
number |
number | Number to set |
# inner setPatternWarning(warning)
Sets the pattern warning of the widget.
Parameters:
Name | Type | Description |
---|---|---|
warning |
string | Warning to set |
# inner setQuery(query)
Sets a dynamic query for the Autocomplete input widget.
Parameters:
Name | Type | Description |
---|---|---|
query |
object | JSON object specifying the collection query, see examples. |
Example
autocompleId.setQuery({ "age": { "$gt": 23 } }) // filter the records with age > 23
# inner setSelectCallback(callback)
Sets a callback that's called when a record is selected, or when a widget is initialized.
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:RMP_TextInput~selectCallback |
# inner setText(text)
Sets the text field of the widget.
Parameters:
Name | Type | Description |
---|---|---|
text |
string | Text to set |
Type Definitions
module:RMP_IncludedCollection
# autocompleteCollection
Collection API for the selected collection, available only for the Autocomplete input widget.
array
# availableAutocompleteData
Collection data that is fetched when user types in a search query, available only for the Autocomplete input widget.
# customDateHandeler(date) → {object}
Updates the default behavior on computing the return date
(including the time) after the end user has entered a
date (without time) in the Date input widget.
Parameters:
Name | Type | Description |
---|---|---|
date |
object | Selected or entered date |
Computed date
object
# loadFailCallback(error)
Called when data is not fetched.
Parameters:
Name | Type | Description |
---|---|---|
error |
error | Failure message |
# loadSuccessCallback(data)
Called when data is fetched successfully.
Parameters:
Name | Type | Description |
---|---|---|
data |
array | Fetched collection data |
# selectCallback(selectedRecord)
Called when a record is selected, or when a widget is initialized with a value.
Parameters:
Name | Type | Description |
---|---|---|
selectedRecord |
object | Selected record |