Source Viewer : /ajax/auto-complete.htm
<p>
This AJAX example uses the <tt>AutoCompleteTextField</tt> control.
</p>
${form}
<p> </p>
The <tt>AutoCompleteTextField</tt> control uses the 'Script.aculo.us' <tt>Ajax.Autocompleter</tt>
class to make an AJAX request when the users a character value. The page's <tt>AutoCompleteTextField</tt>
control handles this AJAX request and returns the list of suggested String values to render.
<pre class="codeJava">
AutoCompleteTextField postCodeField = <span class="kw">new</span> AutoCompleteTextField(<span class="st">"postCode"</span>) {
<span class="kw">public</span> List getAutoCompleteList(String criteria) {
<span class="kw">return</span> getPostCodeService().getPostCodeLocations(criteria);
}
};
postCodeField.setSize(40); </pre>