Skip to Content
0

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

May 12, 2017 at 04:11 AM

74

avatar image
Former Member

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.

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

1 Answer

Best Answer
avatar image
Former Member May 12, 2017 at 06:17 AM
0

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.
Share
10 |10000 characters needed characters left characters exceeded