RMP_FileUpload
FileUpload widget
new RMP_FileUpload(conf)
This constructor allows you to create a fileUpload widget that can be inserted dynamically in your web interface
Parameters:
| Name | Type | Description |
|---|---|---|
| confe | Object | JSON structure which contains the configuration of the fileUpload |
Example
var conf = {"id":"id_upload","label":{"text":"My upload widget"},"variable":[{"name":"upload_variable","value":""}],"js-type":"RMP_FileUpload","tooltip":"My tooltip",
"action":"file_upload","submit":"Submit","file-exts":[{"ext":"png"},{"ext":"pdf"}],"url":"live/1/entity/0f8406f0-3cb7-11e4-804d-f0bf97e1b068/upload?appli=[[appli_id]]&context=[[context]]&P_mode=TEST&P_version="};
var id_upload= new RMP_FileUpload(conf);
id_widget.insertBefore(id_upload);
Methods
browse()
Automatically browses
deleteSelected()
Deletes all selected files
deselectFile(filename)
Deselect the given file
Parameters:
| Name | Type | Description |
|---|---|---|
| filename | string | JSON structure which contains the configuration of the fileUpload |
deselectFileId(fileId)
Deselect the given file by it's id
Parameters:
| Name | Type | Description |
|---|---|---|
| fileId | string |
downloadSelected()
Downloads all selected files
getBrowseButton() → {Object}
Returns:
the element corresponding to the button
Type Object
getContainerIndex() → {String}
Returns:
the index of the container of the widget, it might be the index of the column if the widget is in an array or the index of the tab if it's in a tab panel
Type String
getDeleteButton() → {Object}
Returns:
the element corresponding to the button
Type Object
getDownloadButton() → {Object}
Returns:
the element corresponding to the button
Type Object
getElement() → {object}
This function returns the html object of the widget
Returns: object
getLabel() → {String}
This function returns the label of a widget (if he has one)
Returns: Type String**
getListOfMyVariables() → {object}
This function returns the list of variables of the widget
Returns: object
Example
["id8.label","id8.value"] for list or ["textvar"] for a text input
getMissingVariableMessage() → {String}
This function returns the message displayed if a mandatory widget's variable is missing
Returns: String
getName() → {String}
This function returns the id as string of the widget
Returns: String
getParent() → {object}
Returns:
the parent widget of a widget
Type object
getTooltip() → {String}
This function returns the tooltip text of the widget
Returns: String
getType() → {String}
This function returns the type of the widget(RMP_Image, RMP_Html, RMP_Scripter, RMP_StaticTextwidget, RMP_Button, RMP_TextInput, RMP_ListBox, RMP_MultiSelectionCheckBox, RMP_RadioButton, RMP_Array, RMP_FileUpload... )
Returns: String
getUpload() → {String}
Returns:
The content of the label inside the upload button.
Type String
getUploadButton() → {Object}
Returns:
the element corresponding to the button
Type Object
getUploadedCount() → {int}
Returns:
the number of files that where uploaded.
Type int
getValidationVariableMessage() → {String}
This function returns the message displayed if a validation rule is not met
Returns: String
getValue() → {String}
This function returns the value of the widget's variable. It does not work for list's widgets (check box list, radio button list and list) where you should use widgetID.getSelectedValue.
Returns: String
getVariableValue(varName) → {String}
This function returns the value of a given variable of the widget
Parameters:
| Name | Type | Description |
|---|---|---|
| varName | String |
Returns: String
insertAbove(widget)
This function allows you to insert above widgetID, the new widget created thanks to new RMP_xxx() function
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
insertAfter(widget)
This function allows you to insert on the left of widgetID, the new widget created thanks to new RMP_xxx() function
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
insertBefore(widget)
This function allows you to insert on the right of widgetID, the new widget created thanks to new RMP_xxx() function
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
insertBelow(widget)
This function allows you to insert below widgetID, the new widget created thanks to new RMP_xxx() function
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
isActive() → {boolean}
This function returns true if the widget is active and false otherwise
Returns: boolean
isEmptyVariable(variable) → {boolean}
This function returns true if the the widget's variable is empty and false otherwise
Parameters:
| Name | Type | Description |
|---|---|---|
| variable | String |
Returns: boolean
isEnabled() → {boolean}
This function returns true if a widget is active and false otherwise
Returns: boolean
isIndexed() → {boolean}
This function returns true if the the widget's variable is an array and false otherwise
Returns: boolean
isIndexedVariable(name) → {boolean}
This function returns true if the the widget's variable is an array and false otherwise
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String |
Returns: boolean
isRequired() → {boolean}
This function returns true if the the widget's variable is required and false otherwise
Returns: boolean
isValid(checkRules) → {boolean}
This function returns true if the the widget's variable is valid and false otherwise
Parameters:
| Name | Type | Description |
|---|---|---|
| checkRules | boolean |
*Returns: boolean
isValidVariable(varName) → {boolean}
This function returns true if the the widget's variable is valid and false otherwise
Parameters:
| Name | Type | Description |
|---|---|---|
| varName | String |
Returns: boolean
isVisible() → {boolean}
This function returns true if the widget is visible and false otherwise
Returns: boolean
moveAfter(widget)
This function allows you to move widgetID2 after (on the the right) widgetID1
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
moveBefore(widget)
This function allows you to move widgetID2 before (on the left) widgetID1
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
refresh()
Refresh the widget's list
remove(widget)
This function allows you to remove widgetID. If removeVariable is set to true, it will also deleted content of variable attached to widget
Parameters:
| Name | Type | Description |
|---|---|---|
| widget | object | the inserted widget |
selectFile(filename)
Select a file by it's name
Parameters:
| Name | Type | Description |
|---|---|---|
| filename | string |
selectFileId(fileId)
Select a file by it's id
Parameters:
| Name | Type | Description |
|---|---|---|
| fileId | string |
setActive(active)
This function allows to set the widget as active/inactive
Parameters:
| Name | Type | Description |
|---|---|---|
| active | boolean |
setEnabled(e)
This function allows to set a widget as active/inactive
Parameters:
| Name | Type | Description |
|---|---|---|
| e | boolean |
setLabel(text)
This function sets the label of a widget (except for html, image, array and static text widgets which don't have label field)
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String |
### setMissingVariableMessage(msg)\
This function sets the message displayed if a mandatory widget's variable is missing
Parameters:
| Name | Type | Description |
|---|---|---|
| msg | String |
setRequired(req)
This function sets the mandatory status of the widget's variable
Parameters:
| Name | Type | Description |
|---|---|---|
| req | boolean |
setTooltip(tooltip)
This function sets the tooltip text of the widget
Parameters:
| Name | Type | Description |
|---|---|---|
| tooltip | String |
setUpload(text)
Sets the content of the label inside the upload button
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String |
setValidationVariableMessage(msg)
This function sets the message displayed if a validation rule is not met
Parameters:
| Name | Type | Description |
|---|---|---|
| msg | String |
setValue(value)
This function sets the value of the widget's variable. It does not work for list's widgets (check box list, radio button list and list) where you should use widgetID.setSelectedValue.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | String |
setVariableValue(varName, value)
This function sets the value of a given variable of the widget
Parameters:
| Name | Type | Description |
|---|---|---|
| varName | String | |
| value | String |
setVisible(v)
This function allows to set the widget as visible/invisible
Parameters:
| Name | Type | Description |
|---|---|---|
| v | boolean |
pload()
Uploads the chosen file