autocompleter

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Warning

To use this tag, the head tag must be included on the page

Excerpt Include
ajax common header
nopaneltrue

Description

Wiki Markup
{snippet:id=javadoc|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

...

Wiki Markup
{snippet:id=tagattributes|javadoc=false|url=struts2-tags/ajax/autocompleter.html}

Examples

Get list from an action:

Wiki Markup
{snippet:id=example1|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Uses a list:

Wiki Markup
{snippet:id=example2|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Autocompleter that reloads its content everytime the text changes (and the length of the text is greater than 3):

Wiki Markup
{snippet:id=example3|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Linking two autocompleters:

Wiki Markup
{snippet:id=example4|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Set/Get selected values using JavaScript:

Wiki Markup
{snippet:id=example5|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Using beforeNotifyTopics:

Wiki Markup
{snippet:id=example6|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Using errorNotifyTopics:

Wiki Markup
{snippet:id=example7|lang=xml|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Using errorNotifyTopics:

Wiki Markup
{snippet:id=example8|lang=html|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Using valueNotifyTopics:

Wiki Markup
{snippet:id=example9|lang=html|javadoc=true|url=struts2/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java}

Caveats

  • The service that is producing the HTTP Response with JSON response to the Autocompleter tag must set the HTTP Header Response Content-Type to text/json. JSON has its own MIME type, which this tag expects.
  • Since 2.0.9, there is a change in the value:key order. Now, the value must come before the key.