Skip to content

RMP_TextInput

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

getDate() → {string}

Returns the date field of the Date input widget.

Returns: string

getDefaultValue() → {string}

Returns the default value of the widget.

Returns: string

getNumber() → {number}

Returns the number field of the Number input widget.

Returns: number

getPatternWarning() → {string}

Returns the pattern warning of the widget.

Returns: string

getText() → {string}

Returns the text value of the widget.

Returns: string

getTextType() → {string}

Returns the text type of the widget.

Returns: string

getType() → {string}

Returns the type of the widget (RMP_TextInput).

Returns: string

isFollowKeyPressEnabled() → {boolean}

Returns true if the Keypress field is enabled, otherwise false.

Returns: boolean

setDate(date)

Sets the date field (text) of the Date input widget.

Parameters:

Name Type Description
date string Date to set

setFollowKeyPressEnabled(enabled)

Enables or disables the Keypress field.

Parameters:

Name Type Description
enabled boolean

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

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

setNumber(number)

Sets the number field (text) of the Number input widget.

Parameters:

Name Type Description
number number Number to set

setPatternWarning(warning)

Sets the pattern warning of the widget.

Parameters:

Name Type Description
warning string Warning to set

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

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

setText(text)

Sets the text field of the widget.

Parameters:

Name Type Description
text string Text to set

Type Definitions

autocompleteCollection

Collection API for the selected collection, available only for the Autocomplete input widget.

availableAutocompleteData

Collection data that is fetched when user types in a search query, available only for the Autocomplete input widget.

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