AutocompleteΒΆ

/libs/granite/ui/components/foundation/form/autocomplete

An autocomplete component that gives a list of suggestions to help the user to complete the field.

It extends Field component.

It has the following content structure:

granite:FormAutocomplete
  1. granite:FormField
idstring

The id attribute.

relstring

The class attribute. This is used to indicate the semantic relationship of the component similar to rel attribute.

classstring

The class attribute.

titlestring
i18n

The title attribute.

namestring

The name that identifies the field when submitting the form.

deleteHintboolean
  1. true

true to generate the SlingPostServlet @Delete hidden input based on the name.

valuestring

The value of the field.

If multiple is false, the property type is StringEL, otherwise it is a multiple property of type String.

emptyTextstring
i18n

A hint to the user of what can be entered in the field.

disabledboolean

Indicates if the field is in disabled state.

requiredboolean

Indicates if the field is mandatory to be filled.

validationstring
multiple

The name of the validator to be applied. E.g. foundation.jcr.name. See validation in Granite UI.

multipleboolean

Indicates if the user is able to select multiple selections.

iconstring

The icon class.

values

The renderer to render the user selections (given by the options renderer).

options

The renderer to render the options to be displayed to the user.

Example:

+ myfield
  - sling:resourceType = "granite/ui/components/foundation/form/autocomplete"
  - multiple = true
  + datasource
    - sling:resourceType = "cq/gui/components/common/datasources/tags"
  + values
    - sling:resourceType = "granite/ui/components/foundation/form/autocomplete/tags"
  + options
    - sling:resourceType = "granite/ui/components/foundation/form/autocomplete/list"

Components: