#1 2016-08-23 03:10:16

reg4app
Member
Registered: 2016-05-16
Posts: 147

How to use the ENTER key to move from an Input to another

there are some controls in view ,and these controls is set a TabIndex order,
use 'Tab' key is fine to change the focus,but can i use 'Enter' key to do that??

:cool


Joshua.Y

Offline

#2 2016-08-23 11:23:32

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to use the ENTER key to move from an Input to another

Hello Joshua,

The "TAB" key is the common key to change between controls in the web world and also in the desktop world. Is the standarized way and probably what the user expected. Can we use another key in order to change between controls? Yes, of course we can do it.

Inside the Inputs' controls common KeyUp event, for example, we can access the controls' "Event" variable, who contains information about the pressed key, therefore we can look for the ENTER key and give the focus to the control we wanted.

Take a look at the below application sample, which must be also included in the next App Builder release:

TabWithEnter.zip

Hope this can be useful for you Joshua.

Offline

#3 2016-08-24 03:32:03

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to use the ENTER key to move from an Input to another

the sample works
just be curious,according to online help should we write the code like this:

"[App.Event.keyCode]" "==" "13"

but the sample code:

"[Input1.Event.keyCode]" "==" "13"

Joshua.Y

Offline

#4 2016-08-24 09:56:27

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to use the ENTER key to move from an Input to another

Hello Joshua,

The "Event" variable is available for our application, views and controls events. In our case we must use the Input control "Event" variable of course. smile

Offline

#5 2016-08-25 03:52:06

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to use the ENTER key to move from an Input to another

and would this "Input1.Event.keyCode" work in android&ISO ??:)


Joshua.Y

Offline

#6 2016-08-25 10:16:45

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to use the ENTER key to move from an Input to another

Hello Joshua,

reg4app wrote:

and would this "Input1.Event.keyCode" work in android&ISO ??:)

Honestly, I am not sure if the device's keyboard fired that event when the ENTER key is pressed... In principle I think this is what we can expected, but we need to try it! smile

Offline

#7 2017-06-02 02:59:07

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to use the ENTER key to move from an Input to another

I got three control in a view:Input1,Input2,Button1

in the KeyUp event of Input1

If "[Input1.Event.keyCode]" "==" "13"
  Focus "Input2"
EndIf

This will work fine in Foxfire and Chrome
But in IE
the code just will Trigger the Click event of 'Button1' instead of focusing the 'Input2'

by the way,I use IE10


Joshua.Y

Offline

#8 2017-06-02 07:12:38

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to use the ENTER key to move from an Input to another

Hello Joshua,

Are you take a look at the "TabWithEnter" app sample? If so, and they works as expected (like here) maybe we find a limitation on Internet Explorer 10. Do you receive any kind of error information or something like that? I really can't test it in this version of Internet Explorer, and, in fact, everybody must have at least Internet Explorer 11 installed...

P.S. I refer the "TabWithEnter" app sample included by App Builder, no the attached in this thread: they can work, of course, but I refer in particular to the "TabWithEnter" included app sample.

Offline

#9 2017-06-02 08:24:34

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to use the ENTER key to move from an Input to another

with the  "TabWithEnter" sample,
If I add a "Button1" in it
"Enter" key in IE10,still will trigger the Button1's Click event


Joshua.Y

Offline

#10 2017-06-02 08:27:32

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to use the ENTER key to move from an Input to another

Hello Joshua,

I can't try it on Internet Explorer 10, sorry. Maybe we need a little of JS here because maybe IE 10 do not support the "keyCode" property of the event... so we must use another possible property instead, or another possible approach for that browser.

Offline

#11 2017-06-02 08:28:21

reg4app
Member
Registered: 2016-05-16
Posts: 147

Re: How to use the ENTER key to move from an Input to another


Joshua.Y

Offline

#12 2017-06-02 09:45:51

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: How to use the ENTER key to move from an Input to another

Hello Joshua,

reg4app wrote:

Maybe... it's a bit rare, since we do not use any form... but,... certainly maybe that is the behaviour of IE 10...

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.