when calling client_get_file_name (or any other function tha opens the dialog) to open a file dialog forms is ignoring the directory_name parameter I pass and always opens user's My Documents.
I searched the forum and found that people had the same issue but all of them used Forms version 10. In some of the answers the solution was to install a patch as the cause was actually a bug. Since I'm using a newest version of Forms I'm creating this thread.
I'm using Form Builder 18.104.22.168.0
Java Runtime versions installed and enabled on the machine running the form: 1.6.0_20 and 1.7.0_21
Thanks in advance.
Just for clarification, you said " +I'm using a newest version of Forms+". This may be the newest major version, however the latest patched version is 22.214.171.124, which would include updates for WebUtil if any existed.
As for your issue, because you didn't provide details regarding exactly what you are doing or how you are doing it, I will guess. There is a known issue (bug 10015816) which causes the opening directory to be one lower than what you set as the default. There is a work-around, but it appears to only work with FILE_OPEN_DIALOG. This does the same thing as CLIENT_GET_FILE_NAME so changing should be too much of an issue. The trick to making it work is to add a trailing slash to the end of the directory. For example:
WEBUTIL_FILE.FILE_OPEN_DIALOG ('C:\tmp\hello\ ' ...
Thank you for trying to help.
Allow me to correct the "newest". I wanted to write that I'm using a "newer" form builder version.
Therefore simply thinking I assumed that patches regarding the 10th version of forms are included in the 11th version.
Indeed I didn't provide much detail or code example but it seems you didn't read well, I said it always opens user's My Documents regardless what I set as a directory_name. So, it doesn't seem to be the bug you are mentioning.
Here is how I use this function:
l_filename := client_get_file_name(directory_name => 'C:\',
file_name => null,
file_filter => 'All Files (*.*) |*.*|pdf Files (*.pdf)|*.pdf|JPEG Files (*.jpg)|*.jpg|',
message => 'Choose a file',
dialog_type => null,
select_file => null);
I have done a little more investigating and think I am closer to identifying the root cause of the problem. In the mean time, it appears that you can correct the issue in your plsql simply by adding a blank space after the path, but within the quotes. For example change your code as follows:
Indeed the blank space after the path did the trick. It solved the issue partially though.
The question now is, how do we deal with the case passing NULL to the directory_name parameter? I'm not sure but I think I've read somewhere in the documentation that leaving this parameter NULL gives it the functionality to always hold the last directory opened. So the trick with the blank space doesn't seem to work in this case.
The exact behavior for passing in NULL likely will vary depending on the client OS and the JRE version being used. That said, my opinion is that I would not code the app in such a way to allow the user to not pass a value. If NULL is entered you should either throw a custom error indicating that some path must be enter or hard code your own default location. The user home directory is always a good place to land when nothing is passed in. Expecting to retain the value of the last opened directory is not practical in Forms unless you code that yourself.