473,800 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting the equiv 'upper bound' of a form

Hello all,

I'm trying to do some form validation on a form that collects its data into
a multidimensiona l array, and on submitting that re-writes the values as
hidden form elements (a form that keeps adding submitted values to a
multidimensiona l array).

However, since the hidden form fields have to be identically named to the
visible form fields, I can't make my JavaScript return an error if the field
is blank because there are already fields in the form that are filled.

Essentially, I need a way to refer to the /last/ field in my form with a
given name, instead of the /first/, to check to see if it is empty.

Thanks,
Ken
Jul 20 '05 #1
3 2168
Kenneth wrote:
Essentially, I need a way to refer to the /last/ field in my form with a
given name, instead of the /first/, to check to see if it is empty.


Untested:

function getLastFieldNam ed(oForm, sName)
{
if (oForm
&& oForm.elements
&& sField
&& oForm.elements[sName])
{
var e = oForm.elements[sName];
return (e[0] ? e[e.length - 1] : e);
}

return null;
}

var fld = getLastFieldNam ed(document.for ms["foo"], "bar");
if (fld)
{
// ...
}
HTH

PointedEars
Jul 20 '05 #2
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote :
Untested:

function getLastFieldNam ed(oForm, sName)
{
if (oForm
&& oForm.elements
&& sField
What is sField?
&& oForm.elements[sName])
{
var e = oForm.elements[sName];
return (e[0] ? e[e.length - 1] : e);
}

return null;
}

var fld = getLastFieldNam ed(document.for ms["foo"], "bar");
if (fld)
{
// ...
}
HTH

PointedEars

Jul 20 '05 #3
Vjekoslav Begovic wrote:
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote :
function getLastFieldNam ed(oForm, sName)
{
if (oForm
&& oForm.elements
&& sField


What is sField?


s/Field/Name/g

Sorry, my bad. Changed the argument's identifier and forgot that line.
PointedEars
Jul 20 '05 #4

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

Similar topics

4
13071
by: programmerforhire | last post by:
Hello all, Is there a way to setup an ms-access table so that when I enter text in the 'datasheet' mode, it will automatically be converted tp upper case. Or must I use a Form for this? rex
19
4113
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
6
7149
by: Sib | last post by:
I am trying to read two long values in using scanf() as follows: long lower, upper; scanf("%ld %ld", &lower, &upper); When I enter: 999900000 1000000000 I get: lower = 999900000 but upper = 1 I am obviously missing something here, any idea what?
1
1602
by: Ike | last post by:
Does anyone here remember how to discern the upper bound of an array in asp, pre-.NET ? Thanks, Ike
3
9125
by: Jerry West | last post by:
I'd like to get the upper bound index of an integer array. I've tried the following: Dim i as Integer Dim arrayIng() as Integer i = arrayIng.GetUpperBound This doesn't work. It seems GetUpperBound behaves more like a function in that it wants a passed parameter. Is there not a property similar to VB6
2
2045
by: runway27 | last post by:
i have a registration page which is a self submitting form <form action="<?php echo $_SERVER; ?>" method="POST" id="test2" name="registrationform"> where in a user fill a form, after the data has been inserted to a database i would like to redirect the user to a different page. i am not able to use header(Location: filename.html) as i have echo statements before and i get a message that headers have already been sent. so due to...
3
1332
by: senditontome | last post by:
Hi, Creating databases was never in my job description but I've become increasingly involved in this area and now really enjoy it. I've not had any formal VBA training but picked up lots of excellent ideas and tips from this NG. I'm currently looking for a neater way of going directly to a particlar record in a subform. This is for a database that keeps track of clients and their correspondence (letters). Clients and letters are in two...
12
1906
by: Richard Penfold | last post by:
I am developing an order tracking database, which to keep this explanation simple, consists of 'Orders' table, 'Order Details' table, 'Deliveries' table & 'Inventory' table. There are one-to-many relationships from Orders to 'Order Details, Orders to Deliveries and Orders to Inventory. I have forms to enter and track customer orders and inventory transactions; these work fine but I am having difficulty getting a list-box control to work the...
9
2631
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of the main floors of the main house: Part C: Gross Floor Area of the basement or cellar: Part D: Gross Floor Area of the attic:
0
9550
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10032
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7573
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
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
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.