Skip to Content
avatar image
Former Member

SAPUI5 - read token from input field

Hi,

I am using a Value Help Dialog for one input field. I get the data selected and a "token" is returned to my input field. Now I am trying to read the value of the input field (which contains the token) like this but it does not get the value. When I write something into the input field without using the value help, I get the value.

How can I get the value from the token?

Thanks,

Tim

this.getView().byId("SoldToInput").getValue();
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 31, 2017 at 03:50 PM
    this.getView().byId("SoldToInput").getTokens()
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 30, 2017 at 02:52 PM

    your code.....

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Jun Wu

      Yes, it returns the value as blank, no error.

      json = Object{soldTo: ""}

  • Jan 31, 2017 at 02:34 PM

    debug this portion

    var oCore =sap.ui.getCore();
        var oSoldToInput = oCore.byId("SoldToInput");
        var oHelpTable = oValueHelpDialog.getTable();
        var oContext = oHelpTable.getContextByIndex(oHelpTable.getSelectedIndex());if(oContext){
                var oSel = oContext.getModel().getProperty(oContext.getPath());
        var token1=newsap.m.Token({key: oSel.Customer,text: oSel.Name});
        var oSoldToInput = oSel.Customer;
        that.aTokens=[token1];
        that.theTokenInput.setTokens(that.aTokens);
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      it gets the value from the value help selected line and puts it to theTokenInput and it is then visible in the input field:

      and it is then visible in the input field:

      But how can I then get the value again from the input field? Do I need to read the token again?

      At least with this, I don't get the value:

      this.getView().byId("SoldToInput").getValue();
      debug.png (35.2 kB)
      debug2.png (2.2 kB)