Skip to Content

Issue in Tokens while applying it to MultiInput


I have Multi Input where I am applying tokens to the control. So tokens have key and text properties. Previously I used key as integer and text as user input. The MutiInput tokens can change based user selection. I am storing tokens in model and applying it when user navigates to the same multiinput. Here the duplicate id error occuring. I replaced key value as User text value. But still I am getting the duplicate error. Have anyone came across this situation?


var sFrenchToken = mId.getTokens();

var getKey = sFrenchToken.getProperty("key");

var getTxt = sFrenchToken.getProperty("text");

var arr = [];

arr.push({ text: getTxt, key: getTxt});

var oModelEn = new sap.ui.model.json.JSONModel(arr);

<MultiInput id="mId" tokens="{oModelEn>/}">

<tokens> <Token key="{oModelEn>key}" text="{oModelEn>text}"/> </tokens> </MultiInput>

Error : adding element with duplicate id '__token0-__xmlview3--"id of my control"-0'

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 03, 2017 at 12:48 PM


    Looks like you are trying to get the tokens from the control, take the data from them, and then bind the data to the same control again.

    Why not use only one approach? Either bind and get the data from the model or use the control methods to get / add tokens.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 04, 2017 at 07:40 AM

    Hi Karthik,

    I would suggest you to do the way as Yogesh said.

    Though i didn't get id error, i could see the code broke at the second line.

    You may replace with,

    var getKey = sFrenchToken[0].getProperty("key");

    var getTxt = sFrenchToken[0].getProperty("text");



    Add comment
    10|10000 characters needed characters exceeded