Populating Fields

Overview

You can use forms to collect input from users, but you can also use them to display information as well. For example, if a client browser accesses your phone-directory search engine, you will want to show the results of their search. Your search script (which can be implemented in ASP as well) accepts input, accesses the database, and sends the results in a query string to your display form. This sample is a simple demonstration of how that display form would look.

Code Tour

For the purposes of this sample, the data is hard-coded into the script, but obviously the information could come from an interactive form, database, or text file. This sample starts by initializing the variables. It then creates a form with the HTML <FORM> tags and defines four text boxes. Using the server-side script delimiters <%= ... %>, the script then fills the text boxes with the values set in the initialization.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\interaction\PopulateForm_VBScript.asp and ...\asp\interaction\PopulateForm_JScript.asp.