Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Button in a form trigger on ENTER key from keyboard

Hi,

I have a form with 3 input field and a submit button.In general scenario, User enter data in the fields and click the submit button with the help of mouse.

I want a functionality were when user enter data in the fields and instead of clicking the button with help of mouse, User press enter key from key board, the submit button should trigger and onActionsubmit method should trigger.

i.e. when user presses ENTER key from key board, a button should trigger and onAction button should called.How to get this functionality?

Thanks

Maha

Former Member
Former Member replied

Hi Maha,

You have a form with 3 input field and a submit button.Your Requirement is

I want a functionality were when user enter data in the fields and instead of clicking the button with help of mouse, User press enter key from key board, the submit button should trigger and onActionsubmit method should trigger.

i.e. when user presses ENTER key from key board, a button should trigger and onAction button should called.How to get this functionality?

You can do it in 2 Ways.

1.) In the Properties of InputField there will be a Events OnEnter --> Here you bind the Action onActionsubmit( Action already defined by you for Submit Button ). --> Means if u Press Enter Button in the InputField that Action will raise and Executes your code.

2.) Other way is Create Another Action for InputField(onActionEnter) --> In the InputField's Properties --> Events OnEnter --> Bind the newly Created Action(onActionEnter) to it. --> In that Action(onActionEnter) call the Submit Button Action(onActionSubmit) like below.

public void onActionEnter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionEnter(ServerEvent)

wdThis.onActionSubmit(wdEvent);

//@@end

}

With Regards,

Roop Kumar.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question