Focusing to the first element

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

Focusing to the first element

#1

Postby azaleas » Mon Feb 08, 2016 12:36 pm

I have a panel with bunch of controls in it and when I run the form in Chrome, scroll down to one of the controls on bottom and click a button, browser directly focuses to the first element in my panel. It isnt happening on IE11.

How can I fix this?
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#2

Postby Steve James » Mon Feb 08, 2016 12:40 pm

Try

controls.CONTROLNAME.requestFocus();
0 x

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

#3

Postby azaleas » Mon Feb 08, 2016 1:24 pm

No luck. Any other suggestions?
0 x

Steve
Moderator
Moderator
Posts: 421
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#4

Postby Steve » Mon Feb 08, 2016 4:04 pm

Hi,

Focus will only be gained to the first enterable field if the page is first loaded or you go to a new page.

I tested a form with some enterable fields on and a button. I click the button and this is the behavior:

Chrome - This focuses to the first enterable field.
Firefox - Does not focus on the enterable field, leaves the focus on the button.
IE 11 - Does not focus on the enterable field, leaves the focus on the button.

I believe that Firefox and IE is correct. Chrome is not.

To gain focus to my enterable field in all 3 browsers above I added:

Code: Select all

controls.MyControl.requestFocus(); 
to the bottom of my script.

This worked in all 3 cases.

Steve
0 x

azaleas
Ebase User
Posts: 81
Joined: Thu Jul 30, 2015 12:44 pm

#5

Postby azaleas » Tue Feb 09, 2016 6:23 am

Thanks for answers guys. I managed to make it work. My button was adding a row to a table. So, I had to requestFocus() on table column.
0 x


Who is online

Users browsing this forum: No registered users and 5 guests