Skip to Content

UI5 Input and submit event

Mar 28, 2017 at 03:10 PM


avatar image

According to the notes we are can use the submit event to trigger a function upon pressing Enter or Carriage Return (keycode 13). Not 100% sure about both keys as I suspect they have different values. I'm using the UI5 API version 1.38.4 so it should work as the 'submit' event was introduced in version 1.33.

Anyway, I have something like:

 <input id="something" values ="{rock>serialno}" submit="returnEntered"/> 

in my XML view code, and in my view controller I have something like:

returnEntered: function() {
//Do something

However, when debugging, this function is not being called, or the submit event is NOT being actioned/triggered.

I know there are other ways of doing this using standard JavaScript, but, I would like this triggered from a specific Input field on the view, and ideally using the built-in UI5 options for view/control.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Mahesh kumar palavalli Mar 28, 2017 at 04:32 PM

i hope you have entered some value before pressing enter button and make sure the controller is binded to the view.

Best REgards


Show 2 Share
10 |10000 characters needed characters left characters exceeded

Yes, to the question of entering something into the field before hitting the [Enter] key, and, yes to binding, in that I have model bound to the table for <Input> and the input is using the format value="{alias>field}".

So yes, there is a binding from a model to the table within the controller, but the controller is not bound to the XML in the controller, but we do have an entry in the XML like:


Hopefully that's what you mean by binding the controller to the view. ;)

In theory though, it should still work for any <Input> without a binding to a model via the controller. But either way, it's not working.

As usual, there is very little out there on this subject, and no examples that I can find for using the submit event with <Input>, using XML.

[Appended later...] I have also tried this code in my controller, but still it does not work:

//Execute the onMySearch function when [Enter] is pressed, to save having to hit the button. 
this.getView().byId("searchRef").onsapenter = function() {

I think there might be some other issue, i suggest you to create another project and test it as i've use the submit event of input box many times and it worked else you can go for the browser event of the control, which i wouldnt recomend.

Best Regards,

Gary King Mar 30, 2017 at 12:50 PM

Resolved this issue.

I had a function like so in my view controller:

returnEntered: function(oEvent){

and in my view XML I simply had

<Input .... submit="returnEntered"/>

But this is something that I originally had in my code, and refused to work. Eclipse can be a strange beast sometimes.

Anyway, all is now okay. Thanks to all those that responded.

10 |10000 characters needed characters left characters exceeded
A K Mar 30, 2017 at 05:24 PM

Please close this thread by using "correct answer" button :)

10 |10000 characters needed characters left characters exceeded