...

View Full Version : gripe and question about form controls



beetle
11-14-2002, 04:14 PM
The gripe first

How come when checkbox arrays and radio groups are only have one control they act as a single object and not an array with a length of one? I mean, I know why it's done, but I just don't think it SHOULD be that way. Having them ALWAYS be arrays to the DOM would be so much nicer.

Now the question

Anyone know how checkbox arrays and radio groups will function once XHTML abandons the name attribute? Since ids must be unique, what will link them together creating the array/group?

P.S. These are mostly thoughts outloud, and I realize the answer may be a google-search away, I just wanted to voice them here :D

brothercake
11-14-2002, 04:25 PM
Originally posted by beetle
Anyone know how checkbox arrays and radio groups will function once XHTML abandons the name attribute? Since ids must be unique, what will link them together creating the array/group?


Custom attributes :) Which of course wouldn't be compliant ... so you may as well keep using NAME. I'm not sure how it works from that perspective - the ability to arbitrarily create and use attributes is incredibly useful; methinks XHTML, being extensible, would have a mechanism by which this could be deemed valid?

joh6nn
11-14-2002, 04:31 PM
http://lists.w3.org/Archives/Public/www-dom/2002JanMar/0087.html

according to this, the name attribute had been deprecated for everything but form elements. that was probably an after-thought, after they realized "hey, wait a second, we NEED that!"

as far as the arrays are concerned, the only element that applies to, is the checkbox, because with a radio-button, there should never really be less than 2 of them (some people might argue 3, and technically, that's true, but there are some cases where an on-off switch is not as intuitive as two radio-buttons. no, i can't think of any right now. ). and i agree; it probably ought to be an array of length == 1, but it's not. blame netscape.

beetle
11-14-2002, 05:07 PM
Thanks joh6nn. I agree with you on the 1-radio-button-thing. However, in a site I'm working on now run into occurances where because of dynamically generated data, I may have only 1 checkbox in the array. I had to modify some JS code to handle this. Grrrrr.

whammy
11-16-2002, 11:54 PM
I have found this annoying at times too. I always just end up checking the length of the element. :rolleyes:

And as John says, the name attribute is only deprecated for the form tag itself, not the individual form elements.

That's still kind of a pain since I have to kind of rewrite some of my scripts to pass stuff into functions like (this) or (this.form) since you can't use document.FORMNAME.whatever anymore, but if anything they usually end up being more elegant because of that. (Not that I'm a javascript guru quite yet. ;))



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum