Solved

Create form to input multi records using ASP, VBscript, or Javascript

Posted on 2010-09-23
9
432 Views
Last Modified: 2012-05-10
We want to submit several records into a database table. Currently we do it by importing an Excel sheet, that has the fields in columns, and each row will be a record. How to do this with a webpage, with a link to add an extra line (= record)?

For example, this would be rough example of a table, that we would like to create dynamically line by line on a webpage form:-

record  field1 field2 field3
1            212    34     mod
2            432    54     tran
3            764    21     tour
0
Comment
Question by:pld51
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 18

Accepted Solution

by:
mgfranz earned 250 total points
ID: 33743751
<form action="doInsert.asp">
Field1: <input type="text" name="field1" /><br>
Field2: <input type="text" name="field2" /><br>
Field3: <input type="text" name="field3" /><br>
<input type="submit" name="submit" />
</form>
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 250 total points
ID: 33743756
create an xml from these values, something like

<records>
   <record id="1" field1="212" field2="34" field3="mod"\>
   <record id="2" field1="432" field2="54" field3="tran"\>
   <record id="3" field1="764" field2="21" field3="tour"\>
</records>

and then submit this string to server using post method

once your have fetched this values are server side, you can create the objects out of it and then save them in db
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 33743767
Or maybe I don't understand the question...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33744055
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:pld51
ID: 33745050
Sorry, my question wasn't clear enough it seems. The form itself is not a problem, adding extra lines dynamically was my problem. mplungjan's solution looks like a good answer, using jquery to add another line (=record) to input line by line and then click submit at the vey end.

I am trying out the second link given by mplungjan.
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33745088
<<Sorry, my question wasn't clear enough it seems.>>
You simply had to write, how to add the form elements row dynamically

I think you are looking something like this
http://www.mredkj.com/tutorials/tableaddrow.html
this is also good
http://www.java2s.com/Code/JavaScript/HTML/InsertingRemovingRowElements.htm
0
 

Author Comment

by:pld51
ID: 33745171
<<You simply had to write, how to add the form elements row dynamically >>
Yes, put like that it is quite clear.

To insert each record into the SQL table I presumably need to loop. As all the methods above will take some setting up, any idea which method likely to be easiest to loop through? Or all the same?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33747929
I suggest jQuery because it is almost defacto standard. Gurvinder's link is from 2001 so almost 10 years old. jQuery will work on all modern browsers
0
 

Author Closing Comment

by:pld51
ID: 33856842
Thanks, and sorry for delay
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now