473,574 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically determine current field element?

Hi All,

Is it possible to dynamically determine the current field element in a
form?

I ask because I have a 'tab' button on a form, and when a user clicks
on it I need to be able to shift the focus to the next field, and also
if the current field is the last field on the form, essentially to do
nothing.

Conceptually, I guess I'm trying to do something like:

function clicktab(){

variable = current.field.e lement.number;
if (variable < n) {
variable++;
document.forms[0].element[variable].focus;
}
}

In the above function, "n" would be the total number of fields in the
form.

I'd very much appreciate any assistance anyone can give!

Much warmth,

Murray
Jul 20 '05 #1
4 5480
M Wells wrote:
Hi All,

Is it possible to dynamically determine the current field element in a
form?


If you are willing to do some initializing, you can attach
onfocus-handlers to every field, that write their tabIndex to a global
variable. Then, on click of your tab button, you can increment the
global variable and set focus on that element.

Know how to proceed?
--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #2
document.forms[0].length

M Wells a écrit:
Hi All,

Is it possible to dynamically determine the current field element in a
form?

I ask because I have a 'tab' button on a form, and when a user clicks
on it I need to be able to shift the focus to the next field, and also
if the current field is the last field on the form, essentially to do
nothing.

Conceptually, I guess I'm trying to do something like:

function clicktab(){

variable = current.field.e lement.number;
if (variable < n) {
variable++;
document.forms[0].element[variable].focus;
}
}

In the above function, "n" would be the total number of fields in the
form.

I'd very much appreciate any assistance anyone can give!

Much warmth,

Murray


Jul 20 '05 #3
On Tue, 03 Feb 2004 10:26:43 +0100, Bas Cost Budde <ba*@heuveltop. org>
wrote:
M Wells wrote:
Hi All,

Is it possible to dynamically determine the current field element in a
form?


If you are willing to do some initializing, you can attach
onfocus-handlers to every field, that write their tabIndex to a global
variable. Then, on click of your tab button, you can increment the
global variable and set focus on that element.

Know how to proceed?


Hiya,

What I'm wondering is if there's any way of retrieving the element
number of the field.

So, a way of knowing that document.forms[0].elements[5] currently has
the focus, as opposed to document.forms[0].elements[6] etc.

Much warmth,

Murray
Jul 20 '05 #4
> What I'm wondering is if there's any way of retrieving the element
number of the field.

So, a way of knowing that document.forms[0].elements[5] currently has
the focus, as opposed to document.forms[0].elements[6] etc.


Without any action before? wishing "document.curre ntElement"?
I doubt it, I couldn't find anything pointing in that direction when I
searched. Can you put window.getSelec tion to use?

--
Bas Cost Budde
http://www.heuveltop.nl/BasCB

Jul 20 '05 #5

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

Similar topics

3
3158
by: user | last post by:
Hi, I'm writing a DBI for my company's database. I will have one class for each of the tables in the database. I would then like each class, once instantiated, to be able to read the field list from it's table, and create properties based on each field, with get/set methods created for accessing.
5
1852
by: George Hester | last post by:
Say I have this in a web page: <center><a href="http://www.microsoft.com">www.microsoft.com</a></center> I can use CSS, the DOM and\or JavaScript to determine the width style.innerHTML.length of the www.micosoft.com. But how can I tell in pixels how far it is from the left side of the client area using JavaScript? If the browser is resized...
8
4304
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image button at runtime: //----- Code snippet protected System.Web.UI.WebControls.PlaceHolder ImageHolder; private void Page_Load(object sender,...
0
3145
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where there are tabs at the top with "submenu" buttons showing below the selected tab. The data that defines the tabs and submenus is stored in an XML file...
2
1938
by: djc | last post by:
On the page_load event I am querying a database and binding data to some text boxes, list boxes, and a repeater control. When the page loads it uses the value of one of the database fields (status) to determine what options should be available for this particular item (which is an issue... small issue tracking system). Each of these options is...
5
2086
by: Mike Dee | last post by:
Is it possible to dynamically create a new form object (form1), then create a new form field object and add it form1, and then add form1 to the current document? I need to do all this in script rather than using the html <form> and related tags. Can this be done to support both IE, Firefox? Any code snippets or samples showing how to do...
1
7482
by: vega80 | last post by:
Hi. I have a problem with assigning an onkeypress-function to dynamically created input-boxes.I want to put the content of an input-field into a tag-list when the user hits enter. This works fine the first time (when the input-field is created in a non-dynamical way). The next input-field is created dynamically by a function that is called...
7
2520
by: Ron Goral | last post by:
Hello I am new to creating objects in javascript, so please no flames about my coding style. =) I am trying to create an object that will represent a "div" element as a menu. I have written several methods that are working fine. The problem is if I want to dynamically assign an event handler to the object, the event handler is not called....
5
7135
by: phpCodeHead | last post by:
I am needing to determine how to go about validating that a field in my form contains only a positive integer. I know that this is fairly simple if the form contains only one element to be validated; but, a much bigger challenge ( to me anyway, that's why I'm coming to the pros! ) when I don't know exactly how many fields may appear on the...
0
7720
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7810
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8096
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5618
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5299
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3739
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2240
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1056
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.