Page.RequestString

Ee797481.c++_on(en-US,CS.10).gifEe797481.vb_off(en-US,CS.10).gif

Use this method to retrieve a value from a URL query string or form post variable and perform string processing on it, based on the specified locale.

This processing may involve stripping out leading and trailing white spaces, stripping out carriage returns, checking the length of the string against a specified range, and validating the string based on the specified or default locale.

Ee797481.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 RequestString(bstrName As String,vtDefault As Variant,vtMin As Variant,vtMax As Variant,vtStripWhite As Variant,vtStripReturn As Variant,vtCase As Variant,vtLocal As Variant) As Variant

Parameters

bstrName

A String that contains the name of the URL-query string or form-post variable to retrieve.

vtDefault

A Variant that contains the string to return if the specified URL-query string or form-post variable does not exist or contains no value. If this parameter is not supplied, the method returns NULL. This parameter is optional.

vtMin

A Variant that contains the number that indicates the minimum length against which the length of the bstrName parameter must be validated. If the variant is of type vtMissing, the vtMin parameter value is not considered in the validation process. This parameter is optional. If this value is invalid or length of the bstrName/vtDefault parameter is not in range, the method returns NULL.

vtMax

A Variant that contains the number that indicates the maximum length against which the length of the bstrName parameter must be validated. If the variant is of type vtMissing, the vtMax parameter**value is not considered in the validation process. If this value is invalid or length of the bstrName/vtDefault parameter is not in range, the method returns NULL. This parameter is optional.

vtStripWhite

A Variant that contains a Boolean value that indicates whether leading and trailing white spaces should be stripped from the string. The default value is True. This parameter is optional.

vtStripReturn

A Variant that contains a Boolean value that indicates whether carriage returns should be stripped from the string. The default value is True. This parameter is optional.

vtCase

A Variant that contains the number that indicates the case to which the string should be converted. The default value is zero (0), which results in no modification to the case of the string. If the vtCase parameter is one (1), the string is converted to uppercase. If the vtCase parameter is two (2), the string is converted to lowercase. This parameter is optional.

vtLocal

A Variant that contains the number that specifies the locale to be used as the basis of the conversion. If this value is not specified, the RequestString method uses the value of the Locale property of the DataFunctions object. This parameter is optional.

Return Values

If this method completes successfully, it returns a Variant that contains the processed string.

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
' vString is a Variant
' This example assumes that the string value is entered using 
' the following form:
<FORM METHOD ="POST" ACTION="PROCESS.ASP">
<INPUT TYPE="Text" NAME="String">
<INPUT TYPE="SUBMIT" NAME="ACTION" VALUE="Send Info">
</FORM>
' If the user enters the string into the form and clicks the 
' Send Info button, the value of this form field can be 
' retrieved by the RequestString method as follows:
vString = oPage.RequestString("String", "Default String", _
    1, 100, True, True, 0, 1033)
' In this example, the string is checked that it it contains
' between 1 and 100 characters; all leading and trailing white 
' spaces are removed, all carriage returns are removed, , no 
' modification is made to character case, and the string is
' converted according to the locale 1033 (USA). If no string is 
' input, the string "Default String" will be loaded into the
' variable vString.

See Also

Page Object

DataFunctions.Locale


All rights reserved.