Share this page

# web.convertParam

Miscellaneous Functions

Converts HTML to a URL or plain text.

## Syntax

    web.convertParam( {object} );

## JavaScript Object

Parameter:

    {
       paramName:"<number>",
       sourceString:"<number>",
       sourceEncoding:"<number>",
       targetEncoding:"<number>"
    }

Property Name | Description
--- | ---
paramName | The name of a parameter. The converted string will be saved in this parameter. If sourceString is not used, it initially contains the text to convert. Note that this is not a name–value pair. Pass only the name of the parameter.
sourceString | A literal string to convert. sourceString:"your text"
sourceEncoding | The encoding type of the source data: HTML, URL, or plain text, in the format: `"sourceEncoding=`HTML" `"sourceEncoding=`URL" or `"sourceEncoding=`PLAIN`"`
targetEncoding | The target data format: URL, HTML, or plain text, in the format: `"targetEncoding=URL" "targetEncoding=HTML"`or `"targetEncoding=PLAIN"`

## Return Values

Not applicable

## Parameterization

Standard Parameterization can be used for the Source and Target arguments.

## General Information

The web.convertParam function either converts HTML text to plain text or URL, or converts plain text to URL.

If sourceString is not passed, the text in parameter paramName is converted and the result overwrites the parameter value. If sourceString is passed, the source string is converted and stored in parameter paramName.

sourceString can contain parameters. The source string is first evaluated, replacing parameters with their values, then converted. The result is stored in parameter paramName.

HTML format uses codes for some non–alphanumerical characters, such as &amp; for ampersand. URLs do not support non–alpha–numerical characters and use the escape sequence %number to represent them. To use an HTML value in a URL, you must therefore convert it into an escape sequence or plain text. For example, an ampersand is represented in a URL as %26. When you use this function to convert the HTML to plain text, it converts it to the way the character would appear in a browser.

The following table shows the same content in HTML, URL, and plain text formats:

HTML | URL | Plain text
--- | --- | ---
&lt;mytag&gt;&amp; | %3Cmytag%3E%26 | <mytag>&

This function is useful when you retrieve a URL from an HTML document, and you want to use it in an HTTP request such as web.customRequest.

## Example

    web.convertParam ({
            paramName:"textParam",
            sourceString:"{param1}abc{param2}",
            sourceEncoding:"HTML",
            targetEncoding:"PLAIN"
            });

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: