How do we Connect notepad(text editors) to HTML forms

Results 1 to 3 of 3

Thread: How do we Connect notepad(text editors) to HTML forms

  1. #1
    Join Date
    Dec 1969

    Default How do we Connect notepad(text editors) to HTML forms

    I want to read some data from a text file and then want to display the same on HTML form fields.I dont know how I cna do that using ASP or any other way.<BR><BR>Can you suggest some way out?<BR>Thanx

  2. #2
    John Harvey Guest

    Default Writing text from files to HTML forms

    I&#039m not exactly sure what you mean by HTML form fields, but I&#039ll assume you mean a text box for now. <BR>You can open a text file using the file system object, then you can open the file as a text stream and loop through it while assigning it to a variable.<BR>&#060;%<BR>Dim FSObj, FSOFile, FSOStream &#039File System Objects<BR>Dim strText, FileName &#039Strings<BR><BR>FileName = "C:MyFilesFile.txt"<BR><BR>Set FSObj = Server.CreateObject("Scripting.FileSystemObject")< BR>If FSObj.FileExists (FileName)<BR> Set FSOFile = Server.GetFile (FileName)<BR> Set FSOStream = FSOFile.OpenAsTextStream<BR> Do While Not DataStream.AtEndOfStream<BR> strText = FSOStream.Readline<BR> Loop<BR>End If<BR>&#037;&#062;<BR><BR>Then you can use the variable in your HTML to populate the text box.<BR><BR>...<BR>&#060;textarea ROWS="11" COLS="30" NAME="Message" tabindex="4"><BR>&#060;%= strText&#037;&#062;<BR>&#060;/textarea><BR>Good Luck!

  3. #3
    John Harvey Guest

    Default OOPS, one small correction...

    You should initialize strText before the loop like this<BR><BR>strText = ""<BR><BR>Then replace<BR>strText = FSOStream.Readline<BR>with<BR>strText = strText & FSOStream.Readline<BR>otherwise you overwrite the string each time through the loop. Sorry.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts