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


Yang Ghua

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


DecSoft

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.



Yang Ghua

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


but the sample code:


DecSoft

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. :)



Yang Ghua

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


DecSoft

Hello Joshua,

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! :)



Yang Ghua

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

in the KeyUp event of Input1

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


DecSoft

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.



Yang Ghua

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


DecSoft

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.



Yang Ghua

It looks like something like this
https://stackoverflow.com/questions/13497606/ie10-find-first-button-on-page-and-trigger-click-event-on-input-submit


DecSoft

Hello Joshua,

It looks like something like this
https://stackoverflow.com/questions/13497606/ie10-find-first-button-on-page-and-trigger-click-event-on-input-submit

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


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.