Share via


Page.Option

Ee797844.c++_on(en-US,CS.10).gifEe797844.vb_off(en-US,CS.10).gif

Use this method to generate an OPTION item in an HTML form selection list, and then assign it the value and selection state that you specify. Although this functionality can be created without the Option method, using the method can speed your site development.

Ee797844.important(en-US,CS.10).gif Important

  • This method is included for backwards compatibility with Site Server 3.0 Commerce Edition. See the AppFrameWork object, which provides similar functionality to that found in this method. Using the AppFrameWork methods  is the preferred way of adding this type of functionality to your site, and will ensure better compatibility with future versions of Microsoft Commerce Server.

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 vtVal2 is equal to vtVal1, 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

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

<SELECT NAME="_cc_expyear">
    <% = oPage.Option(2000, iyear) %> 2000
    <% = oPage.Option(2001, iyear) %> 2001
    <% = oPage.Option(2002, iyear) %> 2002
    <% = oPage.Option(2003, iyear) %> 2003
</SELECT> 
' Following is the HTML output that is produced by the ASP script
'  shown previously, 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

Page Object

Page.Check


All rights reserved.