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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required Fields 1

Status
Not open for further replies.

ChrissyLoetz

Technical User
Oct 4, 2005
16
US
Hi there, I found a snippet of javascript code to make a field on my form required. It works fine if the field is coded like this: <input type="text" name="sometext"> but if the field is coded like this <input type="text" name="123"> with numbers in the name attribute, the javascript seems to be ignored. I need to use numbers in the name atrribute because I'm populating a database. Is this possible?
 
Is this possible?
No

-kaht

How much you wanna make a bet I can throw a football over them mountains?
sheepico.jpg
images
 
Assuming you are working with HTML 4, this would be relevant to you...
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

You have to start with a letter.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
It is entirely possible to start the field name with an alphabetic character and still have a numbered field. Simply concatenate a character to the number when you create the field name, and strip if off when you need just the number. We do things like that all the time.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top