Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET form action file - writing to text file

Reply
Thread Tools

ASP.NET form action file - writing to text file

 
 
icedragon icedragon is offline
Junior Member
Join Date: Jul 2010
Posts: 1
 
      07-13-2010
Hey guys,

So I'm trying to write a javascript array to a server-side text file. I've got my form:

Code:
<form id="my_form" action="">  
<input type="text" id="file_name" rows="1" cols="20">  
<a href="javascript: submitform()">Save</a>  
</form>
And the javascript code:

Code:
function submitform();  
{  
var d = seatsArray.join();  
var url = "mysite/savetext.asp?seatsArray="+d + "&file_name=" +   
document.getElementById("file_name").value;  
  
document.getElementById("my_form").action = url;  
document.getElementById("my_form").method = "POST";  
document.getElementById("my_form").submit();  
}
And I'm not sure about how I can make an action file in ASP.NET for this form so that it will write the contents of this array (a separate line for each value) into a text file. It also needs to create the text file and name it what the user put in the "file_name" text box. I tried something briefly but it is incomplete:

Code:
<%  
Dim objFSO, objTStream  
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")  
Set objTStream = objFSO.CreateTextFile("THIS NEEDS TO BE WHAT THE USER ENTERED IN 'FILE_NAME'", True)  
objTStream.WriteLine("THIS NEEDS TO BE THE ARRAY")  
objTStream.Close  
Set objTStream = nothing  
Set objFSO = nothing  
%>
Can you help me out with how to make this work?

Thanks!

John
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts: 1 action, 1 Form, several views handled by 1 only action. Any idea for better design? John Java 0 06-26-2007 11:22 PM
Can we call an Action from another Action in struts??? vyshu Java 1 04-27-2007 09:19 AM
Struts mapping action to action??? runescience Java 3 02-07-2006 04:07 PM
Struts Forward to an Action from an to Action and URLs rjweytens Java 6 06-25-2004 01:49 PM
Struts Static Action Form vs Dyanamic Action Form Joe Bloggs Java 1 08-03-2003 02:30 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57