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

Handling a Space in the name of a text box

Status
Not open for further replies.

danman226

Programmer
Dec 16, 2002
6
0
0
US
I am looking for a way to run the code below:

if (newForm.Registration Code.value == ""){
alert("You must enter a Registration Code")
newForm.Registration Code.focus()
return false
}

The problem is there is a space character in the name of the text field.

How can I read the value of a form element if there is a space in the name? Do I have to make the space an under score?
 
Hi danman,

Most people use "camel case," i.e. RegistrationCode. You could also use an underscore. However, you can't have a space there.

The old thought is that methods are lower-case first word, with a camel case from there, while objects are uppercase first word, camel case from there:

A function would be registerCode(), your id would be RegistrationCode.

Of course, it's your code, do what you'd like-- other than spaces :eek:)
 
Thanks. I thought that might be true but I wanted to be sure.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top