Connecting Tech Pros Worldwide Forums | Help | Site Map

Creating dynamic form with ASP and user inputs

Newbie
 
Join Date: Feb 2007
Posts: 5
#1: Feb 27 '07
I have a web form that users input answers and when submitted I want the ASP code to place the user inputs into certain locations of a HTML form. The form is then automatically opened in a new window and the user can then view, print or save the HTML document. I don't need the data to be saved or stored in a database, just placed in the HTML document. I can create the form document in HTML or PDF whatever is easier to work with.

Can anyone provide a small sample of this code, once it works I can modify as needed.

I have ASP code and a form created and can supply the code if this will help but I thought it would be to much to post.

Thanks,
JR

Newbie
 
Join Date: Feb 2007
Posts: 17
#2: Feb 28 '07

re: Creating dynamic form with ASP and user inputs


Quote:

Originally Posted by jrshack

I have a web form that users input answers and when submitted I want the ASP code to place the user inputs into certain locations of a HTML form. The form is then automatically opened in a new window and the user can then view, print or save the HTML document. I don't need the data to be saved or stored in a database, just placed in the HTML document. I can create the form document in HTML or PDF whatever is easier to work with.

Can anyone provide a small sample of this code, once it works I can modify as needed.

I have ASP code and a form created and can supply the code if this will help but I thought it would be to much to post.

Thanks,
JR

You can use Scripting.FileSystemObject and store your data in simple txt files, when you needed that you can simply use that files with asp code to retrive your data.
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#3: Feb 28 '07

re: Creating dynamic form with ASP and user inputs


If you don't need to save the text, just point the first form to an asp. For example, if you have a text area in your original form named "myText" and a select named "mySelect", the ASP to which you send the form could look like this:
Expand|Select|Wrap|Line Numbers
  1. <form>
  2. <input type="text" value="<%=request.form("myText")%>">
  3. <select>
  4. <option value="herrings"
  5. <% if request.form("mySelect") = "herrings" then response write "selected" %>
  6. >Herrings</option>
  7. <option value="anchovies"
  8. <% if request.form("mySelect") = "anchovies" then response write "selected" %>
  9. >Anchovies</option></select>
  10. </form>
  11.  
Good luck. Please let me know if this works for you.

Jared
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#4: Feb 28 '07

re: Creating dynamic form with ASP and user inputs


Or I guess you don't necessarily want the response in a form, right?
Expand|Select|Wrap|Line Numbers
  1. Value of "myText": <%=request.form("myText")%>
  2. Value of "mySelect": <%=request.form("mySelect")%>
  3.  
Jared
Newbie
 
Join Date: Feb 2007
Posts: 5
#5: Feb 28 '07

re: Creating dynamic form with ASP and user inputs


Quote:

Originally Posted by jhardman

Or I guess you don't necessarily want the response in a form, right?

Expand|Select|Wrap|Line Numbers
  1. Value of "myText": <%=request.form("myText")%>
  2. Value of "mySelect": <%=request.form("mySelect")%>
  3.  
Jared


Thanks for the reply... I want my on-line form to populate fields in a html document. When they submit the on-line form the html document opens in a new window and allows the user to view and print the document with the information supplied with the on-line form. I have code for this but its not working. The file is called "control.asp" and the form is "form.tpl" I think everthing is created I just need the line of code that calls the control.asp and where is it placed.

I can supplied the code if it will help... thanks for the reply
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#6: Feb 28 '07

re: Creating dynamic form with ASP and user inputs


it should be in the form tag:
Expand|Select|Wrap|Line Numbers
  1. <form action="control.asp" method="post">
  2.  
Jared
Newbie
 
Join Date: Feb 2007
Posts: 5
#7: Feb 28 '07

re: Creating dynamic form with ASP and user inputs


Quote:

Originally Posted by jhardman

it should be in the form tag:

Expand|Select|Wrap|Line Numbers
  1. <form action="control.asp" method="post">
  2.  
Jared

Thanks, we'll see if it works and i'll keep in touch...
Reply