AppFrameWork.Option

Ee798372.c++_on(en-US,CS.10).gifEe798372.vb_off(en-US,CS.10).gif

Use this method to generate an OPTION item in an HTML form selection list with the value and selection state that you specify.

Definition

Function Option(vtVal1 As Variant,vtVal2 As Variant) As String

Parameters

vtVal1

A Variant that contains the value of the option in the selection list.

vtVal2

A Variant that contains a value that indicates whether the list option is the selected option. If the vtVal2 parameter is equal to the vtVal1 parameter, then the HTML keyword SELECTED is inserted in the definition of the option list.

Return Values

If this method completes successfully, it returns a String that contains the OPTION item.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

' oAppFrameWork is a Commerce.AppFrameWork object.
' The following example generates a selection field in an
' HTML form to enable the customer to select the expiration
' year of their credit card. The Option method generates
' <OPTION VALUE="> tags and marks the current year 
' as selected: 
<% iyear = Year(date) %>

<SELECT NAME="_cc_expyear">
    <% = oAppFrameWork.Option(2000, iyear) %> 2000
    <% = oAppFrameWork.Option(2001, iyear) %> 2001
    <% = oAppFrameWork.Option(2002, iyear) %> 2002
    <% = oAppFrameWork.Option(2003, iyear) %> 2003
</SELECT> 
' Following is the HTML output that is produced,
' assuming that the current year is 2001:
<SELECT NAME="_cc_expyear">
    <OPTION VALUE="2000"> 2000
    <OPTION VALUE="2001" SELECTED> 2001
    <OPTION VALUE="2002"> 2002
    <OPTION VALUE="2003"> 2003
</SELECT>

See Also

AppFrameWork Object


All rights reserved.