The File Input component for Retool Mobile
An input field to select single or multiple files.
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
accept
A list of file extensions or file-type specifiers to accept.
Type | array |
Array values | string |
Configurability | Inspector > content > File types |
Examples
["image/*", "pdf", "doc"]
customValidation
A custom validation rule using {{ }}
expression with conditional logic. An invalid match evaluates to a string which is used as the validation message. An empty or nullish value is considered valid.
Type | string |
Format | Plain Text |
Configurability | Inspector > Interaction > Validation rules > Custom rule |
Examples
"{{ value.length > 5 ? 'Value must be longer than 5 characters' : '' }}"
disabled
Whether input, interaction, selection, or triggering is disabled.
Type | boolean |
Format | True/False |
Configurability | Inspector > Interaction > Disabled |
Default |
|
Examples
true
events
A list of configured event handlers that trigger actions or queries.
Type | array |
Array values | object |
Configurability | Inspector > Interaction > Event handlers |
Array Object Properties
event
The event that triggers the action. Refer to the events section for details of available events for this object.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Event |
method
The JavaScript method to perform when type
is datasource
, widget
, state
, or localStorage
.
Type | string |
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Run script actions |
type
The type of action to perform.
Type | string | ||||||||||||||
Configurability | Inspector > Interaction > Event handlers > Edit event handler > Action | ||||||||||||||
Allowed Values |
|
Object Properties
lastModified
The last modified date as a timestamp.
Type | number |
Format | Timestamp |
Configurability | Read-only |
Examples
1617024000000
formDataKey
The key used by a Form component to assign default values to input fields using form.initialData
, and to construct the form.data
property.
Type | string |
Format | Plain Text |
Configurability | Inspector > Interaction > Form data key |
Default |
|
Examples
table1.selectedRow.id
hidden
Whether this object is hidden from view.
Type | boolean |
Format | True/False |
Configurability | Inspector > Appearance > Hidden |
Default |
|
Examples
true
hideValidationMessage
Whether to hide the validation message if the invalid
is true
.
Type | boolean |
Configurability | Inspector > Appearance > Advanced > Hide validation message |
isPublic
Whether to make the file public when uploading with Retool Storage.
Type | boolean |
Configurability | Inspector |
label
The text label to display.
Type | string |
Format | Plain Text |
Configurability | Inspector > Content > Add-ons > Label > Label |
Default |
|
Examples
"Label"
placeholder
The text to display within the input field when there is no value.
Type | string |
Format | string |
Configurability | Inspector > Content > Placeholder |
Default |
|
Examples
Enter a value
required
Whether a value is required to be selected.
Type | boolean |
Format | True/False |
Configurability | Inspector > Interaction > Validation rules > Required |
Default |
|
Examples
true
shouldOverwriteOnNameCollision
Whether to replace a file with the same name when uploading with Retool Storage.
Type | boolean |
Configurability | Inspector |
uploadToRetoolStorage
Whether to upload a file to Retool Storage.
Type | boolean |
Configurability | Inspector |
validationMessage
The validation message to display if invalid
is true
.
Type | string |
Format | Plain Text |
Configurability | Read-only |
Examples
blob:example.com/12345678-1234-5678-1234-567812345678
file://path/to/file
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
fileInput.clearValidation()
Examples
Clear the validation message from fileInput
.
fileInput.clearValidation();
fileInput.clearValue()
Examples
Clear the current value of fileInput
.
fileInput.clearValue();
fileInput.focus()
Examples
Set focus on fileInput
.
fileInput.focus();
fileInput.resetValue()
Examples
Reset the current value of fileInput
.
fileInput.resetValue();
fileInput.setDisabled()
Set the disabled
value to toggle whether the input field is disabled. Defaults to true
without a parameter.
fileInput.setDisabled(disabled)
Parameters
disabled
Whether input, interaction, selection, or triggering is disabled.
Type | boolean |
Format | True/False |
Default |
|
Examples
true
Examples
Disable fileInput
.
fileInput.setDisabled(true);
Enable fileInput
.
fileInput.setDisabled(false);
fileInput.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
fileInput.setHidden(hidden)
Parameters
Examples
true
Examples
Hide fileInput
.
fileInput.setHidden(true);
Unhide fileInput
.
fileInput.setHidden(false);
fileInput.setValue(key, value)
Examples
Set the current value of fileInput
to userValue
.
fileInput.setValue(userValue);
fileInput.validate()
Examples
Validate the value of fileInput
.
fileInput.validate();
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
Change | The value is changed. |