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?
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?