Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The autocompleter tag loads its options asynchronously when the page loads, and suggests options based on the text entered in the textbox. If the attribute "autoComplete" is set to "true" (defaults to false), the autocompleter will make suggestions in the textbox, as the user types. The autocompleter will always display a dropdown with the options that have at least a partial match with the text entered in the textbox. If the user clicks on the dropdown button, all the options will be shown in the dropdown. To force the value to be a valid option set the attribute "forceValidOption" to "true" ("false" by default).

Every autocompleter tag will generate two input fields, one of type "text", whose name is specified with the "name" attribute, and one of type "hidden" whose name is "${name}Key", where ${name} is the value in the "name" attribute. Given the following form:

Code Block
HTML
HTML

<s:url id="json" value="/JSONList.action" />

<form action="/someurl">
  <s:autocompleter theme="ajax" href="%{json}" name="state"/>
  <input type="submit">
</form>

When the form is submitted, the request will be something like: /someurl?state=Florida&stateKey=FL. "state" and "stateKey" must be defined as properties of the target action for the url.

Warning
titleRequired properties

Two properties must be defined on the target action for each autocompleter, one for the displayed text (its name is the value of the "name" attribute), and one for the key or value (its name is the value of the "name" attribute plus "Key").

Note
titleAutocompleter input format

Wiki Markup
    The text to be returned from your action must be a list in [JSON|http://json.org/] (Javascript Object Notation).
    Make sure your action returning the JSON list is not decorated adding any extra content.
    Like:
    [
        \["Display Text1", "Value1"\],
        \["Display Text2", "Value2"\]
    ]

//TODO: add example here on how to use JSON Result Type

...