JRS: In article <1x**********@hotpop.com>, seen in
news:comp.lang.javascript, Lasse Reichstein Nielsen <lr*@hotpop.com>
posted at Wed, 23 Jul 2003 20:23:07 :-
Dr John Stockton <sp**@merlyn.demon.co.uk> writes:
Forms are not necessarily intended to be Submitted.
Forms must have an action attribute which represents how to submit
them. I would say that forms *are* intended (by the specification) to
be submitted, even if they somethimes are not by page authors. Those
page authors are the ones giving us, e.g., 'action="javascript:;"'.
The author creates the actual forms!
If you need input elements but don't need them to be submitted, then
you don't need a form element at all. After all, it has no visible
effect on the page, and if you don't submit, no semantic effect
either, so it might as well not be there. The only reason to include
it is easy access to the input elements (though document.forms[]).
There has for me been at least one other reason, although I do not
recall what it was.
It may be, as you suggest, to do with element addressability; or it may
be to do with one or more of the checkers/validators that I have used
insisting that input elements must be in Forms (or at least raising a
complaint that I could only resolve that way). It may be something that
I read here.
However, I can remove the form-enclosure from my js-alarm.htm (apart
from only having one form, it's probably structurally typical of my
pages) and adjust the addressing of controls; it still works in MSIE4,
but I cannot readily check that it works elsewhere.
Forms, as I use them, do split the name-space of the page into separate
scopes, which is certainly useful in pages which have a number of
independent scripted-in/out units. Is there another means of doing
that, known to be widely browser-compatible?
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.