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

i'm told document.almostdone.names has no properties?

Markus
6,050 Expert 4TB
I'm writing something that loops through a form to check if any fields are empty. I got to this:
Expand|Select|Wrap|Line Numbers
  1. function checkEmptyFields()
  2. {
  3.     names = new Array("first_name", "last_name", "country", "city", "dob_d");
  4.     for (i = 0; i < names.length; i++)
  5.     {
  6.         el = document.almostdone.names[i].value;
  7.         if(el.empty())
  8.         {
  9.             alert(el + " was empty");
  10.         }
  11.     }
  12. }
  13.  
But i keep being told
Expand|Select|Wrap|Line Numbers
  1. document.almostdone.names has no properties
  2. http://localhost/blog.mahcuz.com/signup/almostdone/js/validateSignUp.js
  3. Line 6
  4.  
  5. line 6: el = document.almostdone.names[0].value;
almostdone is the name of the form.

Not quite sure ¬_¬
Feb 21 '08 #1
1 896
acoder
16,027 Expert Mod 8TB
The form doesn't have a names array. What you need to use is the elements array, e.g. document.forms["almostdone"].elements[names[i]].value.
Feb 22 '08 #2

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

Similar topics

12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
6
by: skubik | last post by:
Hi everyone. I'm attempting to write a Javascript that will create a form within a brand-new document in a specific frame of a frameset. The problem is that I can create the form and input...
2
by: Robert Oschler | last post by:
I have an IFrame whose document is created completely by Javascript code at runtime. The document in the IFrame accesses Javascript functions in the top level document. This works fine most of...
7
by: michael | last post by:
apologies in advance, as not only am i new to learning how to code javascript properly, i'm new to the groups posting thing... i am developing in firefox 1.0+, but will be working in an msie 6.0+...
9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
3
by: throwaway_addr_12345 | last post by:
OK, looked at the faq, went to faqts.com (discovered irt.org ain't there and webdeveloper.com is hung, but nil else), read every blessed thing I could find on events and handlers at quirksmode...
20
by: weston | last post by:
I've got a piece of code where, for all the world, it looks like this fails in IE 6: hometab = document.getElementById('hometab'); but this succeeds: hometabemt =...
4
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an...
5
by: Martin Rinehart | last post by:
I have added the "Dojo Style Guide" to my conventions compilation, here: http://www.MartinRinehart.com/articles/javascript-conventions.html The Dojo document is more comprehensive than...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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 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.