Gossamer Forum
Home : Products : Others : Fileman :

Entering an invalid file or directory name

Quote Reply
Entering an invalid file or directory name
As a quick test I tried to enter an invalid file name ".test". The alert box comes up, and when you click "OK" to correct it, the onBlur handler puts the alert box back up.
Quote Reply
Re: Entering an invalid file or directory name In reply to
What browser and browser version are you using? I can't reproduce this problem.

Cheers,

Alex
Quote Reply
Re: Entering an invalid file or directory name In reply to
This occurs with IE 4.0 (Version 4.72.2106.8). I just checked with Netscape 4.07, and the error did not show up.

Would the use of an onClick rather than onBlur event handler take care of this?
Quote Reply
Re: Entering an invalid file or directory name In reply to
I tried with IE (although it was version 4.72.3110) and couldn't produce the error.

Do you mean you typed in ".test" clicked Create Directory, then got the error message. You then clicked OK and got the error message right away again? You should be able to hit OK, then fix the name and hit Create.

Cheers,

Alex
Quote Reply
Re: Entering an invalid file or directory name In reply to
Alex,

I too noticed that if there is a "." before file names or directories it would either give me a file error or would not allow me
modify or delete the file or directory.
<especially if your deleting a .htaccess file as an example to delete a directory>
My FTP program handles this problem well.

Currently running Communicator 4.04 going to 4.07 later this week.

I also noticed that if I upload a file, the program names the file the same as the directory size
ex: 499 kb filename = 499

To add to this <grins> the file is not uploaded but does show up as 0 KB using File Manger. Clicking on that file shows nothing in it. FTP Program reports the same.

Suggestions??

Silver


Quote Reply
Re: Entering an invalid file or directory name In reply to
What happens is when I enter an invalid filename like ".test" and click on "Create file", I then receive the error alert box message "Invalid filename. Please re-enter." But when I click on "OK" to clear the alert box so I can retype the filename, the alert box comes back up with the same error message. It does this repeatedly for about 10 clicks on the "OK" button, then works as it should, and I'm able to correct the filename.
Quote Reply
Re: Entering an invalid file or directory name In reply to
The problem is either in the javascript function validateFileEntry, or onBlur is not what is needed. I think the problem lies in if (field) { field.focus(); field.select(); }, once I test this more I'll post a fix *shrug*.
Quote Reply
Re: Entering an invalid file or directory name In reply to
Haven't quite figured out the javascript problem. I can't seem to reproduce the problem on Goassamers test site. *STRANGE*. I'll read through the specific docs on netscape's site. Problem is that the textbox looses focus after the field.select(). I'm not sure why just yet though. Anyone fix this yet?

-Cheers,
RJW

[This message has been edited by QDeath (edited 11-07-98).]
Quote Reply
Re: Entering an invalid file or directory name In reply to
.

[This message has been edited by QDeath (edited 11-09-98).]
Quote Reply
Re: Entering an invalid file or directory name In reply to
getting closer to figuring out the problem! field.focus() doesn't work 100% of the time if the script is run in a frame! Now to find out why!

BLACH! :,-(

-Cheers,
RJW
Quote Reply
Re: Entering an invalid file or directory name In reply to
As a temp fix for now, until I solve this problem, use:
if (field) {
field.value = '';
field.focus();
field.select();
}
This will delete whatever the user types in the textbox. It would be nice to let the user CHANGE their entry instead of retyping, the whole thing but . . . it works for now, until another fix is posted, I'll still continue to look. *ARGH!* This fixes the problem under Netscape as well as under The version of Internet Explorer that Wayne was using. (I happened to have the same version of IE).

if (field)
field.focus();

will also work, note that in this case, the field is not reselected, so the user will have to click on the textbox and retype there choice, as where in the other temp fix, the user can just type as the textbox is already selected.

Anyways... this fix will have to do until I figure out how to fix this problem of loosing focus() :,-(.

[This message has been edited by QDeath (edited 11-09-98).]
Quote Reply
Re: Entering an invalid file or directory name In reply to
Okay, I have what I think is the BEST solution to this problem. This solution, will tell the user which character is invalid and fix the input for them :-)!

Since spacing doesn't seem to work well and the pre tag doesnt't work, bare with this:

function validateFileEntry(validString, field) {
var isCharValid = true;
var i, invalidChar;
for (i=0; i<validString.length; i++) {
if (validString.charAt(0) == '.') {
isCharValid = false;
validString = validString.substr(1, validString.length-1);
i = validString.length;
}
if (validateCharacter(validString.charAt(i)) == false) {
isCharValid = false;
invalidChar = validString.charAt(i);
validString = validString.substr(0, i) + validString.substr(i+1, validString.length-1);
i = validString.length;
}
}
if (i < 1) { return false; }
if (isCharValid == false) {
if (invalidChar) alert("Invalid filename. Can't contain '" + invalidChar + "'. Filename adjusted.");
else alert('Invalid filename. Filename adjusted.');
if (field) {
field.value = validString;
field.focus();
field.select();
}
return false;
}
return true;
}

[This message has been edited by QDeath (edited 11-09-98).]
Quote Reply
Re: Entering an invalid file or directory name In reply to
The below is straight from developer.netscape.com! I think this puts this problem to bed. GOODNIGHT! Tis a known bug . . .

>When focus is given from a form field to the
>top level window, then back to the form
>element, the form's onFocus handler does
>not always get called.

I would suspect they are having problems with focus() as well as onFocus. This problem seems to be fixed in later versions of MSIE, but not in Netscape.

volia! BTW, I've tested my solution on many browsers, many versions and it works on em all :-)

-Cheers,
RJW

[This message has been edited by QDeath (edited 11-11-98).]