viewer.fileOpenAdded by IBM on October 10, 2012 | Version 1 (Original)
|Displays an Open File dialog box and allows the user to select a file. Returns the file name and path of the selected file, but does not actually open the file. This function allows users to select a specific file that is accessed at another time.
For example, the IBM® Forms Viewer uses this function in the preferences form to allow the user to set the location of the Web browser.
Table 1. viewer.fileOpen parameters
|startdir||Directory path||Default directory where the file browser searches for files.|
|extfilters||String||A list of one or more strings, which specify the file extensions that can be selected in the Open File dialog box. The list must be comma delimited, and the strings should follow this format: < text description > *.< ext|
. For example, "HTML document *.html" would represent HTML files. The exact text of the string displays in the Open File dialog box.
Note: A filter of *.* represents any file name or type. A list of file extensions, separated by commas, specifies the types of files to display in the dialog box.
Returns A string containing the path of the file to be opened.
Example The following example sets the URL option in a link button. When the button is selected, an Open File dialog box displays, and the user can select a specific file. The path and file name are returned and used as the URL option for the link button. Because it is a link button, the selected file is opened by the browser.
Note: The parameters in this example specify that the Open File dialog box will default to the My Documents folder, and that it will display both XFDL (.xfd) and HTML (.htm) files.
<url compute="toggle(activated, 'off' , 'on') == '1' ? viewer.fileOpen
('C:\\My Documents' 'XFDL Document *.xfdl, HTML Documents
*.html') : ''">