Fetching Form Values with ASP

Reply

Join Date: Dec 2004
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

Fetching Form Values with ASP

 
0
  #1
Mar 15th, 2007
Hey!

I came up with the new problem. I want to fetch all form values by using request.form("FormName") which is generated by javascript on runtime.

The attached zip code contains the working code of javascript creating dynamic form elements. So after generating a couple of textboxes when I click on the "Submit" button it should display all the values entered in the textboxes on the next page.

Herez a working example of that javascript: http://www.quirksmode.org/dom/domform.html

Is this Possible?


Thanx
Attached Files
File Type: zip RuntimeFormElements.zip (6.3 KB, 2 views)
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: DataGrl is an unknown quantity at this point 
Solved Threads: 0
DataGrl's Avatar
DataGrl DataGrl is offline Offline
Newbie Poster

Re: Fetching Form Values with ASP

 
0
  #2
May 11th, 2007
If you are saying you would rather return the results to an asp page than use the CGI, you can comment out the:
  1. <!--<form method="post" action="/cgi-in/show_params.cgi">-->
towards the end of index.html and insert
  1. <form method="post" action="myNewAspPageName.asp">
Immediately after this line:
  1. <div id="readroot" style="display: none">

Your form will now submit to your new asp page instead of to the CGI.

The next trick is reading the form items when you do not know how many are going to be sent.

Your asp page can determine this for you with:
  1. '--returns all fields (names and values) submitted by the form
  2. strFormInfo = Request.Form
  3. response.write strFormInfo & "<BR>"
Which will return an ampersand (&) delimitted string that looks something like this:
rankingsel=Rating&rankingsew=Rating&cd=title&rankingsel2=Rating&rankingsew2=Rating&cd2=title

From here, you can parse the string as you see fit.

Disclaimer: I do not know the limits of "Request.Form" and how it may be affected by the user's ability to eternally add fields.
Delete * Where FlatFile=True
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 6
Reputation: MohitB is an unknown quantity at this point 
Solved Threads: 0
MohitB's Avatar
MohitB MohitB is offline Offline
Newbie Poster

Re: Fetching Form Values with ASP

 
0
  #3
May 23rd, 2007
Hi,
You can use this code
<%
dim i
For Each i in request.form("FormName")
Response.Write(i & "<br />")
Next
%>
where using i variable u can find the name of cantrol and its value.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC