Forum Moderators: open

Message Too Old, No Replies

Can I do this with JavaScript?

Am new to the language

         

Blelisa

6:07 pm on Sep 27, 2004 (gmt 0)

10+ Year Member



I am looking to write a program that will ask my visitor for some specific input. Than when the visitor inputs the info, it will take the input and write it to a .doc and call another program on my server to come get the .doc and use the information. Is this possible? Thanks!

crashomon

6:34 pm on Sep 27, 2004 (gmt 0)

10+ Year Member



Hi, your question is a good one, however, javascript is primarily a client-side language (that is, most code executes on the client's browser).

What you're asking is fairly simple to do in Perl and PHP (and asp and coldfusion too) and you may want to check out Perl's abilities to capture input data and use it to write to a text file (not a word document, but a text file that can be read by Micro$oft Word if needed).

Here's a supremely oversimplified sample script:

open (FILEHANDLE, ">test.txt") or die "no such file";
print FILEHANDLE "Hello world";
close (FILEHANDLE);

The "hello world" text would be captured from a form input on your webpage and inserted into the test.txt file.

Check with the Perl folks to see if they can help you.

Good luck,

Patrick

PS, I'd be interested to see if it IS possible to write to external files using javascript, especially if its concise code-wise ala Perl.