Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Valid form element names? How to use ID instead of name? Processing form data

Reply
Thread Tools

Re: Valid form element names? How to use ID instead of name? Processing form data

 
 
Robert
Guest
Posts: n/a
 
      03-06-2004
In article <pxj2c.694705$JQ1.149439@pd7tw1no>,
"Grahammer" <postmaster@127.0.0.1> wrote:

> Sorry for the newbie questions...
>
> Is there a link somewhere that shows what defines a valid form object
> (element) name or ID?
>



While HTML allows more characters in the name, you may run into problems
with certain characters. It depends on how you plan on accessing the
variable in JavaScript.

To put the names directly in JavaScript statements

<input type="hidden" name="required_reg_type_1" value="">

document.forms[0].required_reg_type_1.value

I'd go with this:

Letters and numbers plus underscore.

"First, you cannot use any reserved keywords as a variable name."

"Variable names have a couple of other important restrictions. Avoid
all punctuation symbols except for the underscore character. Also, the
first character of a variable name cannot be a numberal." from
JavaScript Bible 4th edition by Danny Goodman.


Or as pointed out ealier in this thread. You can use the quoted way of
access in html name. This could be the preferred style. I do not know.

I guess to address the interaction between how JavaScript and HTML
define names, you can be assured by using the quoted style or make sure
your names do not conflict with JavaScript. I tend to make all my
variable names contain at least two words, such as requiredRegType1 or
required_reg_type_1.


Robert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Valid form element names? How to use ID instead of name? Processing form data Michael Winter HTML 4 03-06-2004 10:21 PM
Re: Valid form element names? How to use ID instead of name? Processing form data Jukka K. Korpela HTML 3 03-06-2004 04:30 PM
Re: Valid form element names? How to use ID instead of name? Processingform data DU HTML 0 03-06-2004 02:44 PM
Document Object Model - table instead of form?? - slow processing in large form! Edward Javascript 0 02-05-2004 11:26 AM
Document Object Model - table instead of form?? - slow processing in large form! Edward Javascript 1 01-04-2004 03:25 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57