cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 sam.m.Input.submit() does not work

VictorHo
Participant
0 Kudos

Hello All,

Currently I want to create a function to handle when user press 'Enter' on Input field (sap.m.Input). I found this suitable function submit() in the API.

However it didn't work, I tried but nothing happen. I pressed enter but it does not call the responding function.

Here my code:

App.view.xml

<mvc:View controllerName="Test.controller.App" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
	<App>
		<pages>
			<Page title="{i18n>title}">
				<content>
					<Input onsapenter='onSubmit'/>
				</content>
			</Page>
		</pages>
	</App>
</mvc:View>


App.controller.js:

sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function(Controller) {
	"use strict";


	return Controller.extend("Test.controller.App", {
		onSubmit: function(oEvent){
			console.log("Submitted");
		}


	});


});

I pressed enter but nothing showed in the console.

I'm looking for help from your expert experience. Is the submit() function does not work anymore? Is there another function to solve my question?

Thanks a lot!

Victor.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Victor,

"onsapenter" event is not avaliable in sap.m.Input. For your requirement, you can go with "sap.m.Input.submit()". Change the below piece of code, try once..

<Input submit="onSubmit" />

Regards,
Naresh.

Answers (0)