Skip to Content

SAPUI5 - this.getView() is not a function

I am trying to get the input value, but when I call the function I get the error this.getView() is not a function

Below is the function in controller

 handleConfirmationMessageBoxPress: function(oEvent) {
        var bCompact = !!this.getView().$().closest(".sapUiSizeCompact").length;
            "Deseja confirmar a transferência?", {
                   icon: sap.m.MessageBox.Icon.SUCCESS,
                   title: "Confirmar",
                    actions: [sap.m.MessageBox.Action.OK, sap.m.MessageBox.Action.CANCEL],
                    onClose: function(oAction) {
                      if (oAction == "OK"){
                          var loginA = this.getView().byId("multiInput").getValue();
                "Transferência efetuada");

                         //"Transferência não cancelada");

                        styleClass: bCompact? "sapUiSizeCompact" : ""

And here is the input in the view

 <m:Input id="multiInput" value="teste" placeholder="Clique no botão ao lado para buscar o usuário" showValueHelp="true" valueHelpRequest="valueHelpRequest" width="auto"/>
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 04, 2017 at 05:15 AM
            var bCompact =!!this.getView().$().closest(".sapUiSizeCompact").length;
    var that=this;
            MessageBox.confirm("Deseja confirmar a transferência?", {icon:sap.m.MessageBox.Icon.SUCCESS,title:"Confirmar",
                        onClose:function(oAction){if(oAction =="OK"){
                              var loginA = that.getView().byId("multiInput").getValue();
                    "Transferência efetuada");}else{//"Transferência não cancelada");}},
                            styleClass: bCompact?"sapUiSizeCompact" : ""});}
    Add comment
    10|10000 characters needed characters exceeded