Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java handling of Strings 1

Status
Not open for further replies.

bkoltys

Programmer
Joined
Apr 11, 2001
Messages
8
Location
US
I am trying to make required fields in a form that contains fields, of First Name, Last Name, Zip code, etc. I have conquered the aspect of the fields being required without problem. My real problem is figurung out how JavaScript handles scripts that aren't strings. Here is the area of my script I'm having trouble with.

if (document.forms[0].21zip.value=="" )
alert ("Please enter a ZIP Code.");


As you can see whomever created this program called the fields with a number in front of them. 21zip, 35fname, 30lname, etc. It seems JavaScript doesn't like numbers. I have tried to simply take out the number aspect, but when I submit the form, any info in those certain fields (zip, last name, etc, come back blank. Obviously because it doesn't recognize my renamed zip from "21zip" to "zip." If you can understand what I'm getting at please help. Is there a way to keep the numbers in these existing fields?
 
I think not... you'll have to add a stirng in front of all of them, like:

fld_1zip
fld_2zip
etc... jared@eae.net -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top