I can't figure out why I cant get this simple loop to work. I'm using it to validate a form. I thought I could put the required field names in an array, loop through the array and have the it check each field. My Firebug error states that 'document.user_reg.check' is invalid. I figure it should read as 'document.user.c_fname.value' for example. -
var check=new Array("c_fname","c_lname","c_title","c_org","c_email","c_email2","c_phone","c_password","c_password2");
-
for(var i=0; i < check.length;i++){
-
if(document.user_reg.check[i].value==null || document.user_reg.check[i].value==''){
-
document.user_reg.check[i].className='error';missing++;
-
}
-
}
-
3 1595
Use the form's elements array: - document.user_reg.elements[check[i]]...
Well I feel stoopid.
Thanks Acoder.
No worries. Glad it helped set you on your way.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: exekutive |
last post by:
I've been wrestling with this programming problem for some time now, so I
thought I'd put it up for discussion. I'm trying to design a Mask function.
See if you can figure out a code for it...
...
|
by: ajikoe |
last post by:
Hi,
I tried to follow the example in swig homepage.
I found error which I don't understand.
I use bcc32, I already include directory where my python.h exist in
bcc32.cfg.
/* File : example.c...
|
by: Brian Blais |
last post by:
Hello,
I am trying to translate some Matlab/mex code to Python, for doing neural
simulations. This application is definitely computing-time limited, and I need to
optimize at least one inner...
|
by: AndersWang |
last post by:
Hi,
dose anybody here explain to me why memset would be faster than a
simple loop. I doubt about it!
In an int array scenario:
int array;
for(int i=0;i<10;i++) //ten loops
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |