Gérard Talbot said the following on 3/16/2006 12:07 AM:
Randy Webb wrote :
I do not keep a log of what everyone says about this or that... so you
may have to repeat... and I'm getting old too
I have read the specs so many times that when I see people quote them I
almost know where to go find it before they tell me. But I still
wouldn't give you 10 cents American for all of them. They are a good
guideline but that is it. I prefer to know what the Browser's behavior
is compared to what it should be
But, for
Of course, it does not make sense. Name/value pairs of form controls are
submitted to the server: that's why name was not deprecated for input,
select and form controls submitting data.
Maybe I may have totally misunderstood that quote from the spec. The
quote might refer only to the form element, not to its contained
elements. I don't know.
From reading that section, and then the section following it on inputs,
I would say it is definitely in relation to the FORM element itself and
not its elements.
<!ENTITY % InputType
"(TEXT | PASSWORD | CHECKBOX |
RADIO | SUBMIT | RESET |
FILE | HIDDEN | IMAGE | BUTTON)"
<!-- attribute name required for all but submit and reset -->
And then in the attlist there is no ID. But further below that it says
"Attributes defined elsewhere" and lists the ID.
So, since it says that form elements are required to have a name it
wouldn't make sense for them to be deprecated
No, it's the other way. If you're using XHTML, then you can't "name"
your form. You have to access your form with the ordinal index.
Or it's ID
So, using the ordinal index instead of the name attribute is more code
portable. That's all I'm saying. I don't necessarly want to promote
XHTML... but then again, there are people who (rightly or wrongly) use
XHTML.
I think both of our opinions are right and both are wrong. The solution
is what best fits the situation
Witness IE's behavior with XHTML. (I
It's rather rare webpage situation... don't you think?
Probably so. When I wrote that I was thinking about a page I wrote for a
friend that orders parts. He has 11 vendors he uses and has to search
all 11 one at a time. I wrote him one that combines them all into one
page. But, it has 12 different forms it uses so he can search
individually and a "search them all" form. But for a web situation, the
most I have seen in practical use is 4 - my bank's website. It has one
for me to login, it has a Google search box (why I want to go to my
banks site to search Google is beyond me though), one for me to contact
the webmaster if I can't login and the fourth is a "I lost my password"
form.
This makes no sense to me. Unless several several people are developing
a same single website. Again, this is not common.
In a workplace, when coding practices are defined, this sort of issues
is explicited for all people adding code or removing code. Usually, only
1 person does make change and he documents these.
I want your job then. I don't get assignments that say "Here is the
page, this is what I need". It's more along the lines of "I want a
snippet/widget that does this, here's your deadline, here's your money,
where's my damn code".
it breaks your code. With a name/ID attribute, that doesn't happen.
Which one is the better practice? There is no ambiguity with
document.forms['formID'] when there is with document.forms[#]
There is room for ambiguity *if* you have more than 1 form element, *if*
someone else is adding another form *before* without noticing the form
issue. I'd say right here that this is extraordinary rare.
I don't. But it still goes back to "The best solution depends, directly,
on the situation". And if you want a "General Best Practice", you either
use the forms NAME or ID to access it. Then, it works in *all*
situations where the form has a NAME/ID.
Best practices should always promote valid, safe, sound practices
which will work reliably across browser, across different DTDs and
across code context.
That alone makes the forms['formID'] a better practice than forms[#].
But, if it is going to be "across different DTD's" then you have to do
something different. Does HTML3.2 allow ID's on forms?
I didn't propose id for forms.
Not directly. You said "Best practices should always promote valid,
safe, sound practices " and that makes forms['formID'] a better -
general - practice than forms[#] because it will work in more situations
than forms[#] will. That was my only point.
One thing is for sure: best javascript practices - whatever they are -
should work in strict DTD (HTML 4.01 or XHTML). Coding for transitional
DTD is already not the best markup coding practice. Best javascript
practices has to be harmonized, coherent, consequent with (and based on)
best markup coding practices to begin with.
I totally agree. But there still has to be a limit somewhere. Otherwise,
you lose the ability to keep a document "general" in scope. I had a
conversation with Richard a long time ago about this same thing. I wish
I could find the thread but I can't. But it was based on best practices
in general and the example that I used was changing the source of an
image. I can write for weeks on end about pre-loading, changing, and
loading images and would probably still miss some of the caveats and
problems with it. But to stay general, you have to limit yourself
somewhere and say "This is it". You change the source of an image by
using the images collection and changing it's src property. This is the
same principle. Somewhere, somehow, you have to limit yourself or you
end up making your guidelines so convoluted that you lose your general
audience by making it *too* complex by including all the caveats/problems.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Please quote what you are replying to.
If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers. <URL:
http://www.safalra.com/special/googlegroupsreply/ >