MultiItem

          Property, read only 
          Member of  ScriptUtils.FormFields 

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
  Other links for MultiItem
Methods of FormFields class
Properties of FormFields class
Contains collection of document fields of files.
      Easy to use, hi-performance ASP file upload component with progress bar indicator. Let's you upload multiple files with size up to 2GB to a disk or database along with another form fields. Works with large posts, any character set (including unicode utf-8). Contains one-click multiple files/folders download with on-the-fly compression (Using BinaryWrite/BinaryRead).
      Hi-performance text file logging for ASP/VBScript/VBA applications. Lets you create daily/weekly/monthly log files with variable number of logged values and extra timing and performance info.
       Lets you work with safearray binary data in VBS/JS. It also enables conversion between binary and String data using several code pages. ZLib compress and uncompress functions. Lets you transfer files using compressed stream from a client to server using IE.
      This library also enables calling of some Kernel and Advapi functions (performance, timing, sleep, configuration ...) and enables native work with INI files.


© 1996 – 2005 Motobit Software, help{at}pstruh.cz, help v. 2.16.14