How to apply OnChange event for AutocompleteTextview with javascript


I tried on change events but they are not working for me.Please help.
as I used Xml as:

<au:RadAutoCompleteTextView items="{{ items }}" suggestMode="SuggestAppend"
didAutoComplete=”{{ onDidAutoComplete }}“
tokenAdded=”{{ onTokenAdded}}“
tokenRemoved=”{{ onTokenRemoved }}"
tokenSelected= "{{ onTokenSelected }}"
tokenDeselected= "{{ onTokenDeselected }}“
suggestionViewBecameVisible=”{{ onSuggestionViewBecameVisible }}"
id=“autocmp” >
<au:SuggestionView suggestionViewHeight=“300”>


and I am Using Nativescript with Javascript I called events like

exports.onTokenSelected = function (args) {
var item =;

But event is not getting called.Please suggest something.


It seems you are missing the curly braces around “onTokenSelected” in the XML.


Actually I tried it with Curely braces…Still it is not working


the provided events are described as follows:

  • tokenAdded - triggered whenever a token is added.
  • tokenRemoved - triggered whenever a token is removed.
  • tokenSelected - triggered whenever a token is selected.
  • tokenDeselected - triggered whenever a token is deselected.
  • didAutoComplete - triggered whenever an item from the suggestions list is selected.
  • suggestionViewBecameVisible - triggered whenever the suggestion view is shown.

so for example

<au:RadAutoCompleteTextView id="autocmp" items="{{ dataItems }}" completionMode="Starts" 
didAutoComplete="onDidAutoComplete" hint="Search for a customer by name" suggestMode="Suggest"  >
                <au:SuggestionView suggestionViewHeight="300">
                        <StackLayout orientation="vertical" >
                            <Label text="{{ text }}" textWrap="true"></Label>

then in your js file

function onDidAutoComplete(args) {
    console.log( args.text);
exports.onDidAutoComplete = onDidAutoComplete;

Note: the curly practise is when binding to functions defined in the View Model; however, most your functions you wanna define them in the code behind the file instead

For more details in all available actions, you should download app and play with it and see its code


Thank You. Now Its working Properly.


Hello,One more question to ask you. as I have to Autocompletetextview On my page and If user seleted 1st one then second one sould be get reset and vice-versa . How to set selected value of Autocompletetextview to Null or default Hint…?


If you are only selecting one value then you should use plain selection mode instead of token selection mode.
If you insist on using tokens view mode then you can use removeToken or removeTokenAtIndex …etc consult the docs

and again, most of the functionalities are already demoed on the app I shared in my previous post.

also this should be your starting point to get how it work and all available options


Yes I am already using plain selection mode for autocompletetextview. I
read all docs related to Autocompletetextview on link. But I am goetting
how to set 2nd autocompletetextview’s selected value to null or empty on
"didAutoComplete" event of 1st autocompletetextview.


use resetAutocomplete() method, so it will be like

function onFirstDidAutoComplete(args) {
    console.log( args.text);
exports. onFirstDidAutoComplete = onFirstDidAutoComplete;


Reset works for me.
Thank you so much for your quick and kind support.