Hi Otavio
So it sounds like it should be pretty easy to do
- Add an empty “Array” to your page
- Add an “Auto Complete” component
- Select the “Auto Complete” component and enter your
- Data Source
- Text Field
- Value Field
Add a “Dynamic Event” of “Data, Value Changed” and set the action to “Array, Add Unique Item” then choose a Value Property, which will be the value of the “Auto Complete”
To see what is going on, add a binding on your page of “Array > Items” which will then update to show each value as it gets pushed into the array.
The one thing this does not do is clear the “Auto Complete” field after an item is added to the Array, so your user needs to remove what was there previously and add their next value.
Alternatively you could place your Auto Complete in a form and clear the form after each option chosen, personally I do not do it this way because normally my form has other data I do not want to be cleared at that stage.
My suggestion would be to select your array, and add a dynamic event of “Value Updated” with an action to Set Value of the auto complete to nothing/blank
Your final code would look something like
<input id="autocomplete1" name="autocomplete1" is="dmx-autocomplete" dmx-bind:data="sc_landlord_codes.data.apiSummary.data" optiontext="title" optionvalue="landlord" dmx-on:changed="arr1.addUniq(value)">
<dmx-array id="arr1" dmx-on:updated="autocomplete1.setValue()"></dmx-array>
{{arr1.items}}