Help > Web Development > Reference > Scripting Objects > Request Object > Form Collection

Request.Form Collection

The forms collection gives you access to the form elements posted in the current HTTP request with a form using the POST method.

Properties
Count Returns the number of form elements sent this request.
Item(name or index) Returns the form element value with the given name or index.
Key(index) Returns the name of the form element at the given index.

Remarks
If the item requested does not exist in the collection Perceptive Enterprise Search will return Empty.

You can access a form element without specifying the Item property by calling Request.Form(variablename). 


Examples
Given the following HTML:
<form action="/" method="POST">
<input type="text" name="firstName" />
<input type="text" name="lastName" />
<input type="text" name="address" />
</form>
When this form is submitted, the web browser will post the following information:
firstName=John&lastName=Smith&address=123+some+street
To output specific form elements you can specify the following script:
First Name: <%= Request.Form("firstName") %> 
Last Name: <%= Request.Form("lastName") %>
Address: <%= Request.Form("address") %>
To enumerate all form elements use the following:
<% For I = 0 to Result.Form.Count - 1 %>
  <%= Request.Form.Key(I) %>: <%= Request.Form(I) %>
<% Next %>
To view all form elements in the raw posted form:
<%= Request.Form %>
Applies To
Request Object