473,322 Members | 1,610 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,322 software developers and data experts.

How can I force a radiobutton to accept focus

110 100+
I have a screen that begins with a radiobutton. For some reason it does not accept focus until the tab key is pressed. I use a js line to assign focus to the radiobutton but the radiobutton does not accept it. All my other pages have focus set on the first object when the page is displayed. What can I do to cause the radiobutton to have focus? Here's the code line I am now using:

Expand|Select|Wrap|Line Numbers
  1.  
  2. document.getElementById('numberPropertyLosses').focus();
  3.  
  4.  
where 'numberPropertyLosses' is the name of the radiobutton set.
Jan 19 '09 #1
5 3898
gits
5,390 Expert Mod 4TB
as far as i'm aware it basicly should work ... FF shows you the focus but IE does not? ... you could try to press the space-bar and the radio should be checked ... so it's quite tricky to handle that issue. you may play with setting a border that 'simulates' the focus for IE and drop it onblur or something like that?

kind regards
Jan 19 '09 #2
andersond
110 100+
Better yet, is there a way to simulate a tab key press? Pressing the space bar has no effect because the radiobutton does not have focus. Once it does have focus pressing the spacebar does, in fact, select it. But I need to give focus to a radiobutton that is first at the top of a new page.
Jan 19 '09 #3
flydev
33
Hmm, I tested this myself, pressing spacebar does check the radio button in IE7, so it just doesn't "appear" to have focus? Chrome showed focus fine.
Jan 19 '09 #4
acoder
16,027 Expert Mod 8TB
@andersond
This is where the problem is. Either use the ID or use:
Expand|Select|Wrap|Line Numbers
  1.  document.getElementsByName('numberPropertyLosses')[0].focus();
Jan 19 '09 #5
gits
5,390 Expert Mod 4TB
ahh ... i overlooked that. but in case the node is selected correctly the above mentioned problem occurs in IE.
Jan 20 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb"...
7
by: Tom wilson | last post by:
I'm trying to create dynamic controls in ASP.Net. It's driving me nuts. I keep getting the error: Control '16' of type 'RadioButton' must be placed inside a form tag with runat=server. Dim...
2
by: Brano | last post by:
HI all, I have two radioButtons on my form. They both have autopostback = true and they are both in the same group. They both have event handlers for CheckedChanged event. My problem is ont of...
3
by: LCAdeveloper | last post by:
Help! A trawl through the archives couldn't shed any light on this, so is there a way to handle DoubleClick events for RadioButtons in vb.NET? I'm recoding a VB4 application, which used the...
5
by: annagel | last post by:
I am looking for a way to force a Tkinter window into focus on a system level. I know the force focus method should bring one window of my application into focus, but it seems I need to have some...
1
by: osmarjunior | last post by:
I override the OnShown event of a form and call both methods Select() and Focus() of a RadioButton. The RadioButton is selected, but the focus rect is not visible. If I press Tab key to exit the...
0
by: rino | last post by:
Hi I have 2 radio buttons and want to perform some kind of validation before I allow the checked state to move from one to another. I tried overriding the validating callback but I noticed that it...
5
by: Matt B | last post by:
I know this is a bit of nonstandard behavior, but I would like the Enter key to move focus through a group of radiobuttons without selecting them. The user would then have to use Space or actually...
0
by: BizEd | last post by:
I have a textbox that fires an autopostback when filled in. The next field after the textbox is a RadioButtonList which I set focus to. The radiobutton list does have focus and activates when you...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.