This field allows the user to select multiple files from the file system. Text can be added before the selection or a static text element can be added to display above the selection box (a little more visually appealing).
The files in the list can be created as a semi-colon separated string in one varibale. It's also possible to let the input field create multiple variables with the given variable appended with indexes. E.g. specifying a variable with name the.file and three files selected in the box would lead to three variables in the installer (the.file, the.file_1, the.file_2).
The multifile
field supports the following attributes for the <spec>
element:
Name | Required | Description | Value |
---|---|---|---|
| no | If set true, no file has to be selected and the box can be left empty. | true, false default: false |
| no | If set true, the given file is required to exist. | true, false default: true |
| no | File extension to be forced. This will be used as mask in the FileChooserDialog. | |
| no | The description of the file extension. This will be used in the file extension mask in the FileChooserDialog. | |
| no | How many rows shall be shown in the list box. | |
| no | The preferred width of the list box. The default is 200. | |
| no | The preferred height of the list box. The default is 100. | |
| no | If set to true, multiple variables will be created. Each file will get one variable. |
Example
Code Block | ||
---|---|---|
| ||
<field type="multifile" align="left" variable="the.file"> <spec txt="" size="25" set=""/> </field> <field type="staticText" align="left" txt="Existing SSL keystore to import:"/> <field type="file" align="left" variable="existing.ssl.keystore"> <spec txt="" size="25" set=""/> </field> |
Messages for the file field can be customized by creating a custom lang pack and overriding the following values (attribute values wrapped for readability):
Example
Code Block | ||
---|---|---|
| ||
<str id="UserInputPanel.file.nofile.message" txt="You must select a valid file."/> <str id="UserInputPanel.file.nofile.caption" txt="No File Selected"/> <str id="UserInputPanel.file.notfile.message" txt="The file you have chosen either does not exist or is not valid."/> <str id="UserInputPanel.file.notfile.caption" txt="Invalid File"/> |
Note:
Mixing multiple file fields with other fields that have text in front of them can lead to formatting (layout) issues. Placing these types of elements on different panels can provide a much better user experience.