on-internet
← Community

Event triggers by itself

Stack Overflow ·

I have no idea why function which should run only when button is pressed runs by herself. Here is my button declaration: var oButton = new sap.m.Button({ id: "buttonId", text: "Yes", press: this.fnB() }); My controller looks like follows: sap.ui.controller("<controller-name>", { fnA: function(){<button_declaration_here>}, fnB: function(){console.log("Hello from fnB!");} }); When I run the app I get: Hello from fnB! Uncaught TypeError: Cannot read property '0' of undefined No buttons pressed yet, so why do I get the hello message? I use SAP WEB IDE if it matters...

Comments

Sign in or sign up to comment and upvote.

No comments yet.