People often want more than one autocomplete control on their page. If you examine the autocomplete example:
function init() {
new mxAjax.Autocomplete({
indicator: "indicator",
minimumCharacters: "1",
target: "statecode",
className: "autocomplete",
paramArgs: new mxAjax.Param(url,{cffunction:"getStateList
"}),
parser: new mxAjax.CFQueryToJSKeyValueParser(),
source: "searchCharacter"
});
}
you will see that the source and destination can be set to whatever you want. So you can just write two blocks
new mxAjax.Autocomplete({
indicator: "indicator",
minimumCharacters: "1",
target: "CONTROL1",
className: "autocomplete",
paramArgs: new mxAjax.Param(url,{cffunction:"SOMEMETHOD1"}),
parser: new mxAjax.CFQueryToJSKeyValueParser(),
source: "CONTROL1"
});
new mxAjax.Autocomplete({
indicator: "indicator",
minimumCharacters: "1",
target: "CONTROL2",
className: "autocomplete",
paramArgs: new mxAjax.Param(url,{cffunction:"SOMEMETHOD2"}),
parser: new mxAjax.CFQueryToJSKeyValueParser(),
source: "CONTROL2"
});
I've shown two method names in the CFC to be called, as the argument needs to be named the same as the search source control, but this isn't a big problem as both of these can in turn call the real method that does the search (so they are just very simple wrapper methods to allow the search to work). Alternatively you could use two optional arguments named after the controls, in a single component.