Skip to Content

How to attach eventhandler to input field in Fiori Elements application

Hi,

Does anyone know how to attach an eventhandler to an input field in a way that the eventhandler also works when reopening the objectpage in a Fiori Listreport?

First time I open an Objectpage I attach the onSubmit to an inputfield in within method onAfterRendering:

onBeforeRendering: function (oEvent) { var oView = this.getView(); var oNamens = sap.ui.getCore().byId(oView.getId() + "--com.sap.vocabularies.UI.v1.Identification::namens::Field-input"); if (oNamens || null) { oNamens.attachSuggestionItemSelected(this._onNamensChanged, this); oNamens.attachSubmit(this._onNamensChanged, this); } },

So when I change the value of this inputfield, method _onNamensChanged is called. This works like a charm.

When I close the Objectpage open again, _onRouteDetailMatched is called, so I coded same logic in this method:

_onRouteDetailMatched: function (oEvent) { var oView = this.getView(); var oNamens = sap.ui.getCore().byId(oView.getId() + "--com.sap.vocabularies.UI.v1.Identification::namens::Field-input"); if (oNamens || null) { oNamens.attachSuggestionItemSelected(this._onNamensChanged, this); oNamens.attachSubmit(this._onNamensChanged, this); } },

But this time _onNamensChanged is not called when I change the value in the input field.

I have no idea why. Anyone?

Cheers,

Robert Dokter

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.