AppFrameWork.RequestString

Ee810535.c++_on(en-US,CS.10).gifEe810535.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.

Definition

Function RequestString(bstrName As String,Optional vtDefault As Variant,Optional vtMin As Variant,Optional vtMax As Variant,Optional vtStripWhite As Variant,Optional vtStripReturn As Variant,Optional vtCase As Variant,Optional vtLocale 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. If this value is invalid or length of the bstrName/vtDefault parameters is not in range, the method returns NULL. This parameter is optional.

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 parameters 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.

vtLocale

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

This method can optionally perform several types of string processing. It can trim leading and trailing white space (space and tab characters) from the string. It can remove carriage returns from the string. It can convert the string to upper- or lowercase.

This method converts the specified String based on the locale specified in the vtLocale parameter if the vtLocale parameter is specified; otherwise it uses the default locale found in the DataFunctions object. It validates the result of the conversion against the vtMin and vtMax parameters, if they are specified.

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.
' 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 = oAppFrameWork.RequestString("String", "Default String", _
    1, 100, True, True, 0, 1033)
' In this example, the string is checked to ensure that 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. If no string is 
' input, the string "Default String" will be loaded into the
' variable vString.

See Also

AppFrameWork Object

DataFunctions.Locale


All rights reserved.