web page with filename entry

C

CarSalesman

I am using FP 2003. I don't know much about scripting
languages, so prefer to do this in html, but maybe its not possible.

We have files stored on our server. The users know the
file names. They are all pdf files. The file names are all
8 characters.

I need to build a web page with a text entry box, where
the user will then type in the 8 character filename, then
press the ENTER key.

The form would have the web site and subfolders hard
coded, as well as the pdf file extension. The only thing
that changes is the 8 character filename. Something like:

http://www.website.com/folder/folder/ENTEREDDATA.pdf

where the capitalized data is entered by the user in a box,
but the user doesn't know the rest of the info.

HELP!

don
 
M

MD Webs Unlimited

Hi,

Use the following example form:

<form action="thefilename.pdf" method="GET" >
<inupt type="text" name="FileName" >
<input type="submit" onclick="this.form.action = this.form.FileName.value;
return true" >
</form>

What the above does is replace the action of the form with the name of the
file when submit is clicked.

Not the code is not very robust and allows the user to enter any path to the
action of the form. Doing so can open security issues. The fix is to prepend
the file name entered.

HTH,
 
C

CarSalesman

Ron,

That example worked well for me. I can do what I want with that.

Now, to dress it up a little, I need another tip.

The data entered by the user is 8 characters. The first digit needs
to be split off, and is actually a folder name. The entire 8 digit name
is then the filename. For example:

user enters: 4D875234

wants to be split up into:

"full_path_name/" + "4" + "/" + "4D875234" + ".pdf"

From the example you gave me, I can make all that work except
for splitting out the "4". I am used to working in cobol, and in that
language, I would write:

variable_name(1:1)

which means to result only part of the variable data, from the
first character (1) and a field (1) character long.

How can I do that with javascript?

Much thanks for your help.

don
 
C

CarSalesman

Oh, if I could be a pain in the butt even more...

How would I modify that action, so that the new file
opens in a new window, instead of the same one?

thank you,

don
 
R

Ronx

Here is one way of generating the path:

var e = document.logon.userid.value;
// Next line of code must be all on one line -
// watch for wrap in the newsgroup
document.location.href = "pages/" + e.substring(0,1) + "/" +
e.substring(1,7) + ".pdf";

I do not know how to ensure a new window, except by using a JavaScript popup
window.
 
C

CarSalesman

Ron,

I was able to use your sample text below to set the folder by
grabbing the first character of the string. Thank you.

Now, however, Internet Explorer won't let the form run, because
it perceives it as a "dangerous active x control". I can bypass the
warning, and it works fine, but I have to by pass it every time I start
the form.

I tried going into the IE settings, and set the security settings,
"initialize and script activex controls not marked as safe" to "enable".

Since the file is currently sitting on my computer, it should automatically
be included in "local intranet", but I made the same change in "internet"
and "trusted sites" zones. Still no good.

Where can I list the filename to eliminate warnings about active x
on the page?

thank you,

don
 
R

Ronx

My example is pure JavaScript, there is no Active X involved. Is there
anything else on the page that could throw this warning?

If you have Windows XP SP2 installed this will block any JavaScript running
from pages stored on your PC. Try opening Internet Explorer, then
Tools->Internet Options->Advanced
Scroll down to the Security section
Tick the box "Allow active content to run in files on My Computer"

Before you click OK think about why this is set to "off" as a default.
 
C

CarSalesman

Ron,

I'm not sure what Active X is involved, but changing that
security setting allowed everything to work. When I finish
cleaning up the page, it will be on our internal server, not
my own computer, so I can turn setting back to the default.

thank you,

don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top