To read the article online, visit http://www.4GuysFromRolla.com/webtech/tips/t053100-2.shtml

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...


Article Information
Article Title: User Tips: Iterating Through the Form Contents Using JScript
Article Author: Raf Q.
Article URL: http://www.4GuysFromRolla.com/webtech/tips/t053100-2.shtml


Copyright 2017 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers