Partager via


appendNameValuePair method

Appends a name-value pair to the data submitted to the server.

Syntax

var retval = IHTMLFormElement.appendNameValuePair(name, value);

Parameters

  • name [in]
    Type: BSTR

    BSTR that specifies the name of the form data.

  • value [in]
    Type: BSTR

    BSTR that specifies the value of the form data.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This method allows an element behavior to insert its own data in the data submitted to a server when a user clicks the submit button on a form.

Data is submitted to the server in the format name=value, with an ampersand (&) separating multiple name-value pairs: name1=value1&name2=value2. You can duplicate this format by repeatedly calling IHTMLSubmitData::appendNameValuePair and IHTMLSubmitData::appendItemSeparator to create multiple name-value pairs separated by ampersands.

Note  You must end a multiple name-value pair listing with a name-value pair, not an ampersand.