Click to See Complete Forum and Search --> : Please help: Displaying a file in a form


vww
01-13-2003, 04:20 AM
Hi everyone,
i've been working on this script for about 2 days now. I am trying to read in a file from the harddisk and display it in a textarea of a form. Another problem is that the file constantly changes so this value needs to be refreshed on occasion. Any ideas on how to display the contents of a file in a textarea? Also, if its possible, can i pick only a specific line from the file to display (like maybe i only want to display line 5 of the file)?

Thanks!

gil davis
01-13-2003, 05:38 AM
how to display the contents of a file in a textarea
http://www.faqts.com/knowledge-base/view.phtml/aid/1899/fid/130
can i pick only a specific line from the file to display
You would have to parse the textarea value. Not sure the linefeeds would still be there.
value needs to be refreshed on occasion
JavaScript has no file I/O operations that would allow you to know when/if the file needs to be refreshed. Only the server would know that.

jalarie
01-17-2003, 08:50 AM
If you have control overt that external file, make it a .js file and pull in whatever you want without all that enablepriviliage stuff.

mawood
01-17-2003, 09:38 AM
I did something similar:


<select name="server_name" class="dropreq" onBlur="NoDupl(this,document.form.server_name_drop)" onChange="createForm2a(form.server_name.value, form.server_name.options[form.server_name.selectedIndex].name)">
<SCRIPT LANGUAGE="JavaScript" src="http://223.4.202.197:8081/ftp_auto/servers.js" type="text/javascript"></script>
</select>



...and servers.js contains:


document.write ('<option value="none" SELECTED>CHOOSE ONE</option>');
document.write ('<option value="dwprod">DWPROD</option>');
document.write ('<option value="trbftp01">trbapp-ftp01</option>');
document.write ('<option value="trbfr01">trbfile-fr01</option>');
document.write ('<option value="orthonet">orthonet</option>');
document.write ('<option value="merallis">merallis</option>');
document.write ('<option value="midway2">Midway2</option>');
document.write ('<option value="adp">adp</option>');
document.write ('<option value="OxfordSLC1">OxfordSLC1</option>');
document.write ('<option value="magsvr1">magsvr1</option>');
document.write ('<option value="magsvr2">magsvr2</option>');
document.write ('<option value="dps">dps</option>');
document.write ('<option value="athena">athenahealth</option>');
document.write ('<option value="nymi">nymi</option>');
document.write ('<option value="monte">monte</option>');
document.write ('<option value="ccs">ccs</option>');