Back to Amphtml

Autocomplete

examples/autocomplete.amp.html

latest3.4 KB
Original Source

Autocomplete

Inline

remote data

{{ . }}

mutate [src]

local data

{{ name }}

{{ email }}

Hello World

Select Event

min-characters = 0, partial red underline

Hello World

Select event with object value

{{city}}, {{state}}

Select a place

Disable browser autofill

form has no autocomplete attr

Personal Email
Autocomplete Email

form has autocomplete="on"

Personal Email
Autocomplete Email

form and input have autocomplete="off"

Personal Email
Autocomplete Email

Attributes

no attributes

Success! {{input1}}

min-characters = 0

Success! {{input2}}

min-characters = 3

Success! {{input3}}

max-entries = 3

Success! {{input4}}

max-entries = 10, min-characters = 0

Success! {{input5}}

submit-on-enter

Success! {{input6}}

highlight-user-entry

Success! {{input6}}

suggest-first

Success! {{input6b}}

suggest-first and submit-on-enter

Success! {{input6b}}

items

Success! {{input6c}}

Filters

substring

Success! {{input7}}

prefix

Success! {{input8}}

token-prefix

Success! {{input9}}

fuzzy

Success! {{input9}}

none to inline data

Success! {{input10}}

none to endpoint

Success! {{input11}}

Datasources in form context

Static data

Your favorite color (in Arabic)
Your favorite color (in English)Your favorite color (in Arabic and English) Success! Thanks {{name}} for subscribing! Please make sure to check your email {{email}} to confirm!

Oops! {{name}}, We apologies something went wrong. Please try again later.

Remote data (with small data)

Your hometownFavorite state, defined item property Success! Mailing a postcard to {{city}}.

Both data sources provided (should cause warning and display remote data)

Your hometown Success! Mailing a postcard to {{city}}.

Neither data sources provided (should cause warning)

Your hometown Success! Mailing a postcard to {{city}}.

Dynamic data, changing json path

Your hometown

Success! Mailing a postcard to {{value}}. Suggest countries Suggest US cities

Dynamic data, changing json object

Your message

Thanks for submitting "{{value}}". Suggest fruit Suggest hellos

Dynamic data, changing json path and object

Your hometown

Success! Mailing a postcard to {{value}}. Suggest fruit Suggest US cities

Templates in search context

Plain Text, Submit on enter

Search for

Here are the results for the search: {{term}}

Rich Text, Template Child, Default Value Property

Search for

{{value}}

Population: {{population}}

Here are the results for the search: {{term}}

Rich Text, Template Child, Custom Value Property

Search for

{{city}}, {{state}}

Population: {{population}}

Here are the results for the search: {{term}}

Rich Text, Template Attribute, Default Value Property

Search for

Here are the results for the search: {{term}}

'Disabled' attribute

{{#disabled}} {{value}} out of stock {{/disabled}} {{^disabled}} {{value}} {{/disabled}}

Fallback

Invalid src path, fallback provided

Your hometown

Sorry, we couldn't load suggestions.

Success! Mailing a postcard to {{city}}.

Failing src path, fallback provided

Your hometown

Sorry, we couldn't load suggestions.

Success! Mailing a postcard to {{city}}.

Invalid src path, no fallback provided

Your hometown

Success! Mailing a postcard to {{city}}.

Failing src path, no fallback provided

Your hometown

Success! Mailing a postcard to {{city}}.