473,326 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

setting focus to a tabe cell.

Hi,

There is a tab control on a page with multiple tabs and handful of
controls in each tab. The way it's rendered in html (like grid etc..)
is in table format in tablerows and cells.

On clientside, on form validation in javascript, I would like to set
focus on to one of the tabs
and set the focus to the control on that tab.

I find this (tab) control by looking through all 'td' s and by it's id.
Now that I have "td" control, I would like to set the focus on to this.
Here is what I do. (FindHtmlControlByID method returns the control
based on type and id)

firstTab = FindHtmlControlByID('TD','UltraWebTab1td0');
secondTab = FindHtmlControlByID('TD','UltraWebTab1td1');

secondTab.style.visibility = 'visible';
secondTab.focus();

textBox = FindHtmlControlByID('INPUT','uiTextBox1');
textBox.style.visibility = 'visible';
textBox.focus();

textBox.focus() fails with the message it's either not visible or not
enabled or it is a type of control that cannot be focused. If the tab
already had focus, then this works ok.

If anybody have an answer, please respond.

Thanks for your time in advance..

Sep 14 '06 #1
1 2479
Why don't you use CSS to show that a tab is active, or inactive ?

You already have both tabs ; I presume that "firstTab" is your tab to
lose focus, and "secondTab" is your tab to get focus, then :

firstTab.className = 'tabNoFocus';
secondTab.className = 'tabFocus';

instead of calling the focus(); method to the table cell elements. Try
to see that method (fucus) as a "give me focus to that element so I can
edit it" method, rather than "select this element". If you can't edit
an element, you shouldn't try to get focus on it.

Using CSS, as described above, will give the apearance to the user that
the tab has been selected, while the other one lost it's selection.

I hope this helps.

-Yanick
Pr**************@gmail.com wrote:
Hi,

There is a tab control on a page with multiple tabs and handful of
controls in each tab. The way it's rendered in html (like grid etc..)
is in table format in tablerows and cells.

On clientside, on form validation in javascript, I would like to set
focus on to one of the tabs
and set the focus to the control on that tab.

I find this (tab) control by looking through all 'td' s and by it's id.
Now that I have "td" control, I would like to set the focus on to this.
Here is what I do. (FindHtmlControlByID method returns the control
based on type and id)

firstTab = FindHtmlControlByID('TD','UltraWebTab1td0');
secondTab = FindHtmlControlByID('TD','UltraWebTab1td1');

secondTab.style.visibility = 'visible';
secondTab.focus();

textBox = FindHtmlControlByID('INPUT','uiTextBox1');
textBox.style.visibility = 'visible';
textBox.focus();

textBox.focus() fails with the message it's either not visible or not
enabled or it is a type of control that cannot be focused. If the tab
already had focus, then this works ok.

If anybody have an answer, please respond.

Thanks for your time in advance..
Sep 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: joe | last post by:
Hi Everyone, could anyone comment on the following problem: I have a textbox being appended to a cell in a table, and am trying to call focus() on like this: <snip> c01.removeChild(answerbox);...
3
by: Darrell Wesley | last post by:
I have an application with 2 forms. Form1 is the main form and has 2 text boxes on it. Form2 is a datagrid showing a list of workorders that are to be manufactured. The user can use the mouse to...
21
by: Sharon | last post by:
I have added an auto scroll feature to my DataGrid control like this: private void DoAutoScroll() { DataView dv = m_DataGrid.DataSource as DataView; DataGridCell cell = m_DataGrid.CurrentCell;...
3
by: sailu | last post by:
Hi, Anyone knows how can i set the focus to a particular cell in DataGrid. Thanks, Sailaja.
8
by: jonny_morrisuk | last post by:
Hi! I have a scrollable css table cell thing going on, and would like to set the initial page focus to that cell in order that scrolling up and down with the cursor keys (or mouse scroll wheel...
2
by: lasher168 | last post by:
Hi, I have the neccesity to place focus on a piece of text which is a cell inside a table. The reason why I need this is because whenever the page refreshes it always goes to the top of the...
0
by: RKT | last post by:
I have a DataGridView bound to an MS Access table. This is a single- user application. When the User is adding or editing a row, the User may click on a Control elsewhere. That Control has context...
1
by: Lcoggshall | last post by:
Hi everyone, I am on site and have a huge issue I need an answer to ASAP. I have a Touch screen application. This app has a bbrower with 1 cell that is editable. Because it is a touch screen,...
4
by: foolmelon | last post by:
Before AJAX, we were able to focus a cell in a gridview during a fullpage postback. After putting the gridview inside an UpdatePanel, we cannot focus a cell in this gridview anymore. Does anybody...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.