XF 2.2 Autocomplete on custom data

stromb0li

Active member
I see xenforo has the ac="single" property on a textbox to enable auto-complete on member usernames, but is it possible to override the source data used in completion? I.e. either specify endpoint to call or by feeding in a variable that is an array of the values to lookup?
 
Yes, you can use the following...

HTML:
<xf:textboxrow name="item" label="Item" explain="Enter your item name."
                id="js-ItemSelector" 
                ac="single"
                data-acurl="{{ link('addon/item/auto-complete') }}" />

Of course you'll need to build the action in the appropriate controller to make it work.
 
Thank you! Is there an example or documentation on what is expected for the output? Is it possible to return back a key value paiR< where the key is the lookup field and the value is the value set in the control?
 
Top Bottom