This may not be something that's needed for many but I thought I'd give it a shot anyways because I've come across two different use-cases myself. It would be nice if, when using auto-complete, we could specify a data-hidden-id-field, or something similar, that could be updated when an auto-complete target is selected.
I'm thinking we could write something like this:
Once the "item" row is updated with the text, then the javascript could also update the "item_id" field with the id that's returned in the response params. There may be better ways to implement this, but the idea is simply that we can update a field to include the item_id rather than the text response, while still keeping the text in the textbox so users don't get confused.
I'm thinking we could write something like this:
Code:
<xf:textboxrow name="item" label="Item" explain="Enter your item name."
id="js-ItemSelector"
ac="single"
data-acurl="{{ link('addon/item/auto-complete') }}"
data-hidden-id-field=".js-HiddenItemId" />
<xf:hiddenval name="item_id" class="js-HiddenItemId" value="" />
Once the "item" row is updated with the text, then the javascript could also update the "item_id" field with the id that's returned in the response params. There may be better ways to implement this, but the idea is simply that we can update a field to include the item_id rather than the text response, while still keeping the text in the textbox so users don't get confused.
Upvote
0