When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips

Sections:
Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
User Tips: Iterating Through the Form Contents Using JScript


By Raf Q.

Here is how to check all your form or query fields with JScript as the server-side scripting language. Note: If you replace Request.form with Request.querystring, you get all your query elements!

function showFormData(){
  laAnswers = new Array();
  lnAnswerno = 0;
	
  Response.write("<table border=1>");
	
  for(e = new Enumerator(Request.Form); !e.atEnd(); e.moveNext()){
    laAnswers[lnAnswerno] = Request.Form(e.item());
      if (laAnswers[lnAnswerno] == "")
        Response.write("<tr><td>"+lnAnswerno+"</td><td>"+e.item() +
                       "</td><td>.NULL.</td></tr>");
      else
        Response.write("<tr><td>"+lnAnswerno+"</td><td>"+e.item() +
                       "</td><td>" +laAnswers[lnAnswerno]+"</td></tr>");

      lnAnswerno++;
  }
  Response.write("</table>");
}

To learn more about JScript, study the JScript information on Microsoft's Scripting Site and read the following 4Guys articles:

Happy Programming!

Return to user tips...


ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article