(1) Your question has *NOTHING AT ALL* to do with ASP. ASP runs on the server. You are wanting code that runs on the client, in the browser.
(2) If you save the data on the local system, it will only be available on that system. That is, no other users will be able to see it.
(3) So long as you write using VBScript code in the browser, only people using Microsoft Internet Explorer can use the code.
(4) In order for the browser (even MSIE) to write data to the local drive, the HTML page *MUST* come from a "Trusted Server". In most cases, this means it will have to come from some inTRAnet server, not across the inTERnet.
(5) Even coming from a trusted server, the user will have to allow the page to use code that is considered "unsafe for scripting". That is, the user will have to say "OK" or "Yes" when prompted to allow the page to do the unsafe code.
***********
If you are aware of all of the above and still want to proceed, then yes, it can be done.
CSV willl be easier to create. VBScript doesn't have any built in controls to make it easy to create XML data.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
TQ for the reply.Yes..the security issue wont be a problem because this form will be used internally.which is intranet..I am using IIS server..would you be kind to help me to create a function inside the code which whan i click the save button it will save it to local drive.I just want to try it out to save it 1st,then i will enchance it...how can we do like what u have mention in number (5) comment...
Unless you mean that EVERY PERSON USING THIS will be running IIS on HIS/HERE PERSONAL MACHINE, then IIS has nothing to do with this.
One more time: WHEN YOU USE SCRIPT IN THE BROWSER, this has *NOTHING* to do with IIS.
***********
One more important question: *HOW* will you know *WHERE* to save the data on the user's machine???
Presumably, every user has DIFFERENT FILES and DIFFERENT DIRECTORIES on his/her machine. If you try to save this into a particular directory (example: C:\SavedFormData) what happens if the directory does NOT EXIST on some user's machine?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
I will be given the path to save it in specific share folder...But do you think it is possible?..I think it would be such a waste of space and it is complicated if each and every time the click save,it save save the form which in a long time will use up some amount of space..Need your opinion and advice on this because I am an intern and i was told to do like this.So,If i can enhance this,it will be better.Is it possible to connect with database?And how shall i submit this form to database?Please give me an example on how to do that?TQ
Well, you *COULD* always OVERWRITE the file in the shared folder. So the file might grow, but there could be only one file, if you wished.
However...
Your instinct to use a database is MUCH MUCH BETTER IDEA!!! Good for you!
Now you WOULD use IIS on a webserver. And yes, you COULD use ASP code (written in VBScript, so you don't have to learn another language right now) to do this.
You could save the data in one or more tables in a SQL Server or MySQL or Access database (in order of choice). You could have a field in the table(s) that tells who owns the particular data, so that when a user comes back to the page you could, if they wanted you to, re-load the data from the DB. More than that, any administrator with proper permissions could look at ANY of the records in the table(s) and so view what any person in the company has saved, if that is at all desirable.
**********
If your boss insists, then yes, you could do this all in the browser. But your idea is, I think, at least 10 times better.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Thank you for the explanation..But can u show me an example how could i save this whole form which has table that the row is added according to the need of the user...I a beginner so it would be better if u can show me some examples which i can use it as a reference...TQ man..N sorry for the trouble...
I will tell you that if you are trying to save <form> fields to a database with ASP code (or, for that matter, even if you want to save them to a logal file!) you are much better off using *NAMES* that are incremented by a counter and FORGET ABOUT THE IDs!
Form fields do not, in general, need IDs. So don't use them when you don't need them.
And for the field names, I recommend that you use names that VBScript will *recognize* as names.
So... Here, for example, is my rewrite of one of your functions:
Code:
Sub doAddRow()
Dim oTbl, oRow, oCell
Set oTbl=document.getElementById("mytable")
Set oRow = oTbl.insertRow
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Lot_Number_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Location_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Total_In_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Test_1star_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Test_2star_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Test_3star_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Total_Out_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Lot_Status_" & count & "' />"
Set oCell = oRow.insertCell
oCell.innerHTML= "<input name='Remark_" & count & "' />"
count = count+1
End Sub
Now, in your ASP code, you can easily pull the data from all those rows, based on the row count.
Example:
Code:
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "...you will need to supply a connection string here..."
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "yourDbTableName", conn, 3, 3
userid = Session("UserId") ' I won't explain this now...read some tutorials first
For count = 1 To 9999
lotnum = Trim(Request("Lot_Number_" & count))
If lotnum = "" Then Exit For ' no more data from form
RS.AddNew ' add a record to the db
RS("userid") = userid ' say who this record belongs to
RS("Lot_Number") = lotnum
RS("Location") = Trim(Request("Location_" & count))
RS("Total_In") = Trim(Request("Total_In_" & count))
RS("Test_1star") = Trim(Request("Test_1star_" & count))
RS("Test_2star") = Trim(Request("Test_2star_" & count))
RS("Test_3star") = Trim(Request("Test_3star_" & count))
RS("Total_Out") = Trim(Request("Total_Out_" & count))
RS("Lot_Status") = Trim(Request("Lot_Status_" & count))
RS("Remark") = Trim(Request("Remark_" & count))
RS.Update
Next ' go get another row
RS.Close
conn.Close
%>
But this is getting ahead of you. Way ahead of you. First you have to create the database then create the table that will hold this data. And so on and so on.
You have several weeks of learning ahead of you.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.