Autofill API (Beta)
1 min
Note Optimizely Forms is only supported by MVC-based websites and HTML5-compliant browsers.
This is a Beta feature, which means that it is still in development.
In Forms.Core, DataElementBlockBase uses Autofill to prefill an element with a value from an external system.
AutofillService finds AutofillProvider based on the MappingTable as input, and gets suggestions from them. For example, if formElement is set to Email, AutofillProvider checks the CRM system and selects Email data from the ContactTables and returns a suggestion.
Note Render <datalist> as suggestions for a visitor that views a form in View mode.
An element rendered in View mode can have a pre-selected value that is determined by the following input (by priority):
- Manual input from a user When a visitor selects a value, it is retained in the element.
- External system autofill If a form is connected to a Marketing Automation (MA) system, the MA system can provide information about the visitor to prefill into the element value as the selected value. The first suggestion is set automatically in the input as a predefined value.
- Predefined value An editor sets it in edit view.

- In the demo project DemoSystem acts like both IExternalSystem and IAutofillProvider.