MultiItem Property, read only of FormFields class

Property, read only | Member of  ScriptUtils.FormFields | Changes | Purchase | Download

Description

Returns a specific multiselect field from the FormFields by key.

Syntax

Set vMultiItem = FormFields.MultiItem (Name as String)
 

Where Type Optional Default Description
 Name  String     Name of the source field. 

Returns

FormFields - Contains collection of document fields of files.

Remarks

MultiItem has a similar functionality as an Item property, but always returns FormFields collection. Use ScriptUtils.FormFields.MultiItem property instead of ScriptUtils.FormFields.Item property to enumerate MULTIPLE SELECT fields.

Examples

Multiselect fields (non-unique field names)

<%
'Sample file Form-MultiItem.asp 
'Use MultiItem to enumerate MULTIPLE SELECT fields
  Option Explicit

  Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")

  If Form.State = 0 Then
    Dim Field

    'You can use MultiItem property to access collection of MULTIPLE SELECT form field
    Response.Write "<br>Number of 'NoSelect' fields in the source form:" & Form.Items.MultiItem("NoSelect").Count
    Response.Write "<br>Number of 'SelectOne' fields in the source form:" & Form.Items.MultiItem("SelectOne").Count
    Response.Write "<br>Number of 'SelectMore' fields in the source form:" & Form.Items.MultiItem("SelectMore").Count

    'You can use both MultiItem and Item property to access a value of MULTIPLE SELECT form field

    'Form.Items.MultiItem(...) returns Items collection, the collection values are converted to a string.
    Response.Write "<br>Value of 'NoSelect' field in the source form:" & Form.Items.MultiItem("NoSelect")
    Response.Write "<br>Value of 'SelectOne' field in the source form:" & Form.Items.MultiItem("SelectOne")
    Response.Write "<br>Value of 'SelectMore' field in the source form:" & Form.Items.MultiItem("SelectMore")

    'Form.Items("NoSelect") returns empty
    Response.Write "<br>Value of 'NoSelect' field in the source form:" & Form("NoSelect")
    'Form.Items("SelectOne") returns one field, which is evaluated to a string
    Response.Write "<br>Value of 'SelectOne' field in the source form:" & Form("SelectOne")
    'Form.Items("SelectMore") returns three fields, which are enumerated and evaluated to a string
    Response.Write "<br>Value of 'SelectMore' field in the source form:" & Form("SelectMore")

    'You cannot use Item property to enumerate MULTIPLE SELECT field. 
    'Return type of Item Collection depends on number of form fields with specified name in the source document.
    'Use MultiItem property to enumerate MULTIPLE SELECT fields.

    'Form.Items.MultiItem("NoSelect") contains no field
    For Each Field In Form.Items.MultiItem("NoSelect")
      Response.Write "<br> " & Field.Name & ", Length:" & Field.Length & ", Value:" & Field
    Next

    'Form.Items.MultiItem("NoSelect") contains one field
    For Each Field In Form.Items.MultiItem("SelectOne")
      Response.Write "<br> " & Field.Name & ", Length:" & Field.Length & ", Value:" & Field
    Next

    'Form.Items.MultiItem("NoSelect") contains three field
    For Each Field In Form.Items.MultiItem("SelectMore")
      Response.Write "<br> " & Field.Name & ", Length:" & Field.Length & ", Value:" & Field
    Next
  End If 'Form.State = 0 then
%>  
<br>sample For <A Href=http://www.motobit.com>HugeASP upload</A>
<br>Use MultiItem To enumerate MULTIPLE SELECT fields
<form name="file_upload" method="POST" ENCTYPE="multipart/form-data" >
<input Name=SourceFile1 Type=File><br>
<input Name=SourceFile2 Type=File><br>
<SELECT NAME="NoSelect" SIZE="4" MULTIPLE>
  <OPTION VALUE="Option 1">Option 1
  <OPTION VALUE="Option 2">Option 2
  <OPTION VALUE="Option 3">Option 3
</SELECT><br>

<SELECT NAME="SelectOne" SIZE="4" MULTIPLE>
  <OPTION VALUE="Option 1" SELECTED>Option 1
  <OPTION VALUE="Option 2">Option 2
  <OPTION VALUE="Option 3">Option 3
</SELECT><br>

<SELECT NAME="SelectMore" SIZE="4" MULTIPLE>
  <OPTION VALUE="Option 1" SELECTED>Option 1
  <OPTION VALUE="Option 2" SELECTED>Option 2
  <OPTION VALUE="Option 3" SELECTED>Option 3
</SELECT><br>

<input Name=SubmitButton Value="Submit >>" Type=Submit><br>
</Form>

Script output:
Number of 'NoSelect' fields in the source form:0
Number of 'SelectOne' fields in the source form:1
Number of 'SelectMore' fields in the source form:3
Value of 'NoSelect' field in the source form:
Value of 'SelectOne' field in the source form:Option 1
Value of 'SelectMore' field in the source form:Option 1, Option 2, Option 3
Value of 'NoSelect' field in the source form:
Value of 'SelectOne' field in the source form:Option 1
Value of 'SelectMore' field in the source form:Option 1, Option 2, Option 3
 SelectOne, Length:8, Value:Option 1
 SelectMore, Length:8, Value:Option 1
 SelectMore, Length:8, Value:Option 2
 SelectMore, Length:8, Value:Option 3

See also

FormFields.Item

Other links for MultiItem

Methods of FormFields class

Save

Properties of FormFields class

Count, Files, Item, Items, MultiItem, Texts

ScriptUtils.FormFields

Contains collection of document fields of files.

ScriptUtils

Huge ASP upload is easy to use, hi-performance ASP file upload component with progress bar indicator. This component lets you upload multiple files with size up to 4GB to a disk or a database along with another form fields. Huge ASP file upload is a most featured upload component on a market with competitive price and a great performance . The software has also a free version of asp upload with progress, called Pure asp upload , written in plain VBS, without components (so you do not need to install anything on server). This installation package contains also ScriptUtilities library. Script Utilities lets you create hi-performance log files , works with binary data , you can download multiple files with zip/arj compression, work with INI files and much more with the ASP utility.

© 1996 - 2011 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz


Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object