Folder, File
Folder and file selection
To choose a file instead of a folder, the desired option has to contain "file": true
. When the field type is file
, the file is required and only the folder is passed, the validation will fail.
Specification
options
Available types:
string
A URL of RPC returning the list of folders or files.
object
A detailed configuration of folder/file list.
Available parameters:
store
string
An URL of RPC returning the list of folders or files.
ids
boolean
If set to true
, you can work with folder IDs. That means that GUI loads previously selected folders and their labels after reopening the form without having to call the RPC again.
showRoot
showRoot
Default: true
. If set to false
, top-level folders aren't prefixed with /
and there's no option to choose the root /
. When the type is file
, the root selection is blocked automatically.
singleLevel
boolean
Default: false
. If set to true
, only a single level of folders is available.
Examples
Result of RPC
To display the folder/file selector properly, the output from your RPC should contain only objects matching the following samples.
option
Available parameters:
label
string
A label to be displayed.
value
string
A value of an option which will be used in code.
file
boolean
Boolean to determine if the option is a file or a folder.
{
"label": "Documents and Settings",
"value": "documentandsettings"
}
Folder Selection
To make your folder selection work properly, you need to create a remote procedure that will return the corresponding folders. Each time a folder is selected, the RPC is called once again and the parameter path
containing the whole path in the string is passed. You need to filter the folders inside this RPC.

File Selection
The file selection is very similar to the folder selection, but keep in mind that files in your RPC result have to contain "file": true
property. Each time a file is selected, the RPC is called once again and the parameter path
containing the whole path in the string is passed. You need to filter the folders and files inside this RPC.

Last updated