go
Expand Minimize

AutoCompleteSaveForm method

Saves the specified form in the AutoComplete data store.

Syntax

var retval = external.AutoCompleteSaveForm(Form);

Parameters

Form [in]

Type: Variant

Variant of type Object that specifies a reference to a form element.

Return value

Type: HRESULT

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

Standards information

There are no standards that apply here.

Remarks

Use this method to store input type=text and input type=password values to AutoComplete data storage. After information is entered in a form and saved to AutoComplete storage, whenever a user visits a Web site and starts typing in a field with the same name as a stored field, the AUTOCOMPLETE attribute provides an AutoComplete box containing a list of previously stored data.

To enable the AutoComplete feature for forms, choose Internet Options from the Tools menu, click Content, and then click AutoComplete. To disable the feature for individual form controls and entire forms, use the AUTOCOMPLETE attribute.

This method is included in Microsoft Internet Explorer 5 and later. It is not supported in HTML Applications (HTAs).

Examples

This example uses the AutoCompleteSaveForm method to save the value of a text field without submitting the form to a server.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/AutoCompleteSaveForm.htm


<!DOCTYPE html>
<html>
<head>
  <title>AutoCompleteSaveForm Method</title>
  <style>
    body {
      font-size: 8pt;
      font-family: Arial;
    }
  </style>
</head>
<body>
  <h1>AutoCompleteSaveForm Method Sample</h1>
  <p>
    The <strong>AutoCompleteSaveForm</strong> method saves <strong>INPUT type=text</strong> and <strong>INPUT type=password</strong> values into an encrypted AutoComplete store.
    Enter some text into the following text fields.
    Click the Save Value button to invoke the <strong>AutoCompleteSaveForm</strong> method.
    Once the values are saved, the text fields are cleared.
    Try typing in the same values and you will notice that the first text field contains the value in the AutoComplete list, while the second text field did not store the value.
    The <strong>AUTOCOMPLETE</strong> attribute is used to disable the AutoComplete feature for the second text field.
  </p>
  <form id="oForm">
    This text is saved:
    <input type="text" name="AutoCompleteTest" />
    <br>
    This text is not saved:
    <input type="text" name="AutoCompleteIgnore" autocomplete="off" />
  </form>
  <p>
    <input type="button" value="Save Value" onclick="fnSaveForm()" />
  </p>
  <script>
    function fnSaveForm() {
      var oForm = document.getElementById('oForm');

      window.external.AutoCompleteSaveForm(oForm);
      oForm.AutoCompleteTest.value = "";
      oForm.AutoCompleteIgnore.value = "";
      alert("Saved!");
    }
  </script>
</body>
</html>

See also

external
Using AutoComplete in HTML Forms

 

 

Show:
© 2014 Microsoft