Search Persits Software Knowledge Base

 

Article PS01032617

Upload.Form returns only the first selected item of a multi-select control

Problem Description

When retrieving values from a multi-select control such as <SELECT NAME="Choice" MULTIPLE> using AspUpload, the collection Upload.Form, unlike Request.Form, only returns the first selected value.

An attempt to reference additional values using an expression such as

val = Upload.Form("Choice")(1)

generates the following error:

Microsoft VBScript runtime (0x800A01C3)
Object not a collection: '[object]'

Solution

Although the collection Upload.Form is not identical to Request.Form, you can still use it to retrieve all selected values from a multi-select control.

Upload.Form stores all selected values from a multi-select control as separate items, but under the same name. The following code snippet prints out all selected items from the control <SELECT NAME="Choice" MULTIPLE> :

<%
For Each Item in Upload.Form
  If Item.Name = "Choice" Then Response.Write Item.Value
Next
%>

Created: 2/8/2002 5:28:14 AM
Last Modified: 2/9/2002 4:15:31 PM

Copyright © Persits Software, Inc. 1998 - 2018
For technical support, write to support@persits.com.