Hey guys,
So I'm trying to write a javascript array to a server-side text file. I've got my form:
And the javascript code:
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:
Can you help me out with how to make this work?
Thanks!
John
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