xhtml and input tag outside form

Hello,

I have tried to understand why input field is valid outside form tag.
I seems to work outside form if e.g. input tag is inserted inside div tag.

I tried to read http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
but didn't find any solution.

Can anyone clearify were input is accepted if it's not inside form?

Cheers,
Zone [ Di, 22 Januar 2008 21:14 ] [ ID #1914170 ]

Re: xhtml and input tag outside form

Zone wrote:

> I have tried to understand why input field is valid outside form tag. I
> seems to work outside form if e.g. input tag is inserted inside div tag.

<input> (and <textarea>, <button>) is an inline element, like <span> or
<em>, so can be used in any context where inline content is allowed, which
is virtually everywhere.

Why? Because otherwise <input> couldn't be contained in, for example, a
paragraph, even if that paragraph was itself within a form,

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 23 days, 20:54.]

CSS to HTML Compiler
http://tobyinkster.co.uk/blog/2008/01/22/css-compile/
Toby A Inkster [ Mi, 23 Januar 2008 10:43 ] [ ID #1914927 ]

Re: xhtml and input tag outside form

Zone wrote:
> Hello,
>
> I have tried to understand why input field is valid outside form tag.
> I seems to work outside form if e.g. input tag is inserted inside div tag.
>
> I tried to read http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
> but didn't find any solution.
>
> Can anyone clearify were input is accepted if it's not inside form?

Besides what Toby said about why it's valid (which is correct) it's also
reasonable if you're using controls to receive user input that is going
to be used on the client side rather than for submitting to a server. An
example would be a client-side measurement or currency converter coded
in Javascript. Functionally speaking there's no need for a form since
nothing is being submitted to the server.
Harlan Messinger [ Mi, 23 Januar 2008 11:08 ] [ ID #1914928 ]

Re: xhtml and input tag outside form

Scripsit Toby A Inkster:

> <input> (and <textarea>, <button>) is an inline element, like <span>
> or <em>, so can be used in any context where inline content is
> allowed, which is virtually everywhere.

Well, not quite everywhere. Not in the document's head, and in Strict,
not in its body either. :-)

(Just kidding. But really, in Strict versions, <input> is not allowed
_directly_ inside <body>, i.e. as a child element, only indirectly
inside a block-like container.)

> Why? Because otherwise <input> couldn't be contained in, for example,
> a paragraph, even if that paragraph was itself within a form,

No, the syntax rules _could_ have been written so that <input> is only
allowed inside a <form> directly or indirectly. That would be fairly
simple in classic HTML, nominally based on SGML (which has exclusion
exceptions). It would not be possible at the DTD level in XHTML, based
on the toy version of SGML called XML, but it could have been added as
requirement in prose, just as XHTML 1.0 prosaically forbids an <a>
element inside an <a> element even though its DTD syntax allows it.

The real reason is that people who decided on HTML specs wanted to allow
lone <input> elements for use with client-side scripting.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
jkorpela [ Mi, 23 Januar 2008 12:13 ] [ ID #1914933 ]

Re: xhtml and input tag outside form

"Jukka K. Korpela" <jkorpela [at] cs.tut.fi> wrote in message
news:1jFlj.285172$8v3.64083 [at] reader1.news.saunalahti.fi...
> Scripsit Toby A Inkster:
>
>> <input> (and <textarea>, <button>) is an inline element, like <span>
>> or <em>, so can be used in any context where inline content is
>> allowed, which is virtually everywhere.
>
> Well, not quite everywhere. Not in the document's head, and in Strict, not
> in its body either. :-)
>
> (Just kidding. But really, in Strict versions, <input> is not allowed
> _directly_ inside <body>, i.e. as a child element, only indirectly inside
> a block-like container.)
>
>> Why? Because otherwise <input> couldn't be contained in, for example,
>> a paragraph, even if that paragraph was itself within a form,
>
> No, the syntax rules _could_ have been written so that <input> is only
> allowed inside a <form> directly or indirectly. That would be fairly
> simple in classic HTML, nominally based on SGML (which has exclusion
> exceptions). It would not be possible at the DTD level in XHTML, based on
> the toy version of SGML called XML, but it could have been added as
> requirement in prose, just as XHTML 1.0 prosaically forbids an <a> element
> inside an <a> element even though its DTD syntax allows it.
>
> The real reason is that people who decided on HTML specs wanted to allow
> lone <input> elements for use with client-side scripting.
>
> --
> Jukka K. Korpela ("Yucca")
> http://www.cs.tut.fi/~jkorpela/

Can anyone explain where are the code in
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
that tells input tag can be outside of form tag but it must be e.g. inside
div tag.

This kind of issues can be tested by a validator but I would like know how
to read it from DTD file's syntax.

Cheers,
Zone [ Mi, 23 Januar 2008 16:25 ] [ ID #1914943 ]

Re: xhtml and input tag outside form

Scripsit Zone:

> "Jukka K. Korpela" <jkorpela [at] cs.tut.fi> wrote in message
> news:1jFlj.285172$8v3.64083 [at] reader1.news.saunalahti.fi...
....
>> --
>> Jukka K. Korpela ("Yucca")
>> http://www.cs.tut.fi/~jkorpela/

A comprehensive quote, down to a sig, is the usual sign of lack of
comprehensive reading. Please keep using that style as long as you
remain clueless. Using XHTML in web authoring isn't a _sure_ sign of
cluelessness, you know, though often a useful hint.

> Can anyone explain where are the code in
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
> that tells input tag can be outside of form tag but it must be e.g.
> inside div tag.

Is that a serious question? It looks like one, but other symptoms
suggest the opposite,

Anyway, here are some crucial declarations from it:

<!ENTITY % block
"p | %heading; | div | %lists; | %blocktext; | fieldset | table">

<!ENTITY % Block "(%block; | form | %misc;)*">

<!ELEMENT body %Block;>

Now, how can you have an <input> element inside the body? Hint: check
the definition of %misc to see that there's nothing there that allows
<input>. Then work out the declarations for the block-level elements
like <p> and <div> to see that <input> is allowed there

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
jkorpela [ Mi, 23 Januar 2008 16:50 ] [ ID #1914948 ]

Re: xhtml and input tag outside form

In article <NmJlj.285285$iM4.194787 [at] reader1.news.saunalahti.fi>,
"Jukka K. Korpela" <jkorpela [at] cs.tut.fi> wrote:

> Scripsit Zone:
>
> > "Jukka K. Korpela" <jkorpela [at] cs.tut.fi> wrote in message
> > news:1jFlj.285172$8v3.64083 [at] reader1.news.saunalahti.fi...
> ...
> >> --
> >> Jukka K. Korpela ("Yucca")
> >> http://www.cs.tut.fi/~jkorpela/
>
> A comprehensive quote, down to a sig, is the usual sign of lack of
> comprehensive reading. Please keep using that style as long as you
> remain clueless. Using XHTML in web authoring isn't a _sure_ sign of
> cluelessness, you know, though often a useful hint.
>
> > Can anyone explain where are the code in
> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
> > that tells input tag can be outside of form tag but it must be e.g.
> > inside div tag.
>
> Is that a serious question? It looks like one, but other symptoms
> suggest the opposite,
>
> Anyway, here are some crucial declarations from it:
>
> <!ENTITY % block
> "p | %heading; | div | %lists; | %blocktext; | fieldset | table">
>
> <!ENTITY % Block "(%block; | form | %misc;)*">
>
> <!ELEMENT body %Block;>
>
> Now, how can you have an <input> element inside the body? Hint: check
> the definition of %misc to see that there's nothing there that allows
> <input>. Then work out the declarations for the block-level elements
> like <p> and <div> to see that <input> is allowed there

It's such a damn shame or a sight to behold (I rather fancy the
latter, there being too many damn shames in this world already)
that you can be so informative (the point about the %misc being
something that perhaps only you and 4 others on the planet would
have spotted *quickly*) yet give all this personally insulting
preamble babble.

How is it that something like me from a quite different planet
can see that the OP is quite sincere and serious and you can't?
Perhaps you need to get out of Iceland more often. Perhaps Bobby
Fisher's late presence has had an unsettling effect deep down for
years?

--
dorayme
dorayme [ Mi, 23 Januar 2008 21:15 ] [ ID #1914965 ]

Re: xhtml and input tag outside form

Scripsit dorayme:

[ quoting something that he or she has almost nothing to say about, and
no positive contribution ]

> It's such a damn shame or a sight

Excuse me while I yawn.

> How is it that something like me from a quite different planet
> can see that the OP is quite sincere and serious and you can't?

If you quote like a moron, stay tuned to being treated like one.
Sometimes you might get away with it, but that's not a reason to act
moronically.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
jkorpela [ Mi, 23 Januar 2008 22:32 ] [ ID #1914973 ]

Re: xhtml and input tag outside form

Jukka K. Korpela wrote:
> Scripsit dorayme:
>
> [ quoting something that he or she has almost nothing to say about, and
> no positive contribution ]
>
>> It's such a damn shame or a sight
>
> Excuse me while I yawn.
>
>> How is it that something like me from a quite different planet
>> can see that the OP is quite sincere and serious and you can't?
>
> If you quote like a moron, stay tuned to being treated like one.
> Sometimes you might get away with it, but that's not a reason to act
> moronically.
>
How about people who act like venom-spitting sociopaths? How should they
expect to be treated?
Harlan Messinger [ Mi, 23 Januar 2008 22:54 ] [ ID #1914975 ]

Re: xhtml and input tag outside form

dorayme wrote:

> Perhaps you need to get out of Iceland more often.

Finland, Shirley?

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 24 days, 9:49.]

CSS to HTML Compiler
http://tobyinkster.co.uk/blog/2008/01/22/css-compile/
Toby A Inkster [ Mi, 23 Januar 2008 23:36 ] [ ID #1914986 ]

Re: xhtml and input tag outside form

In article <85sk65-0k9.ln1 [at] ophelia.g5n.co.uk>,
Toby A Inkster <usenet200801 [at] tobyinkster.co.uk> wrote:

> dorayme wrote:
>
> > Perhaps you need to get out of Iceland more often.
>
> Finland, Shirley?

Mrs Goldberg is having a drink at the bar of her regular club
when an oriental gentleman accidentally knocks over her drink.

"You damned Japanese!" yells Mrs Goldberg. "First you gave us
Pearl Harbour, now this!"

"Hold on a minute. I'm not Japanese, I'm Chinese."

"Chinese, Japanese — so what's in a name?"

"And you Jews," replies the Chinese, "you can talk! You sank the
Titanic!"

"We sank what?" asked the astonished Mrs Goldberg, "The Titanic
was sunk by an iceberg!"

"Iceberg, Goldberg. So what's in a name?"

--
dorayme
dorayme [ Do, 24 Januar 2008 01:09 ] [ ID #1914995 ]
Miscellaneous » alt.html » xhtml and input tag outside form

Vorheriges Thema: Automatic Source View
Nächstes Thema: Getting photos into email