xhtml and input tag outside form

M

Martin Honnen

Zone said:
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?

HTML 4 and XHTML 1 allow form controls outside of 'form' elements as you
might want form controls in your HTML document for scripting or other
reason where you do not need to submit form data to the server. On the
other hand an old browser like Netscape 4 does not render form controls
outside of 'form' elements but Netscape 4 is not of relevance anymore.
As for where the DTD defines that form controls are allowed outside of
'form' elements, the relevant definitions are as follows
<!ENTITY % inline.forms "input | select | textarea | label | button">
<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; |
%inline.forms;">
<!-- %Inline; covers inline or "text-level" elements -->
<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
<!ELEMENT p %Inline;>
that defines the contents of p elements and allows form controls
(defined by inline.forms). There are similar definitions for other
elements allowing form controls too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top