Why doesn't this form validate ?

A

Arjen

Hi, this piece of html doesn;t validate. That w3c validator sais
something about block elements in inline elements. As I understand it
<p><form></form></p> is valid or am I wrong ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
</head>
<body>
<div id = "testx">
<p>
text<br />
<form action="index.php" method="post">
veld:<br />
<input type="text" name="field" id="field"><br \>
<input type="submit" id="submitid" value="Submit" />
</form>
</p>
</div>
</body>
</html>
 
E

Ed Jay

Arjen scribed:
Hi, this piece of html doesn;t validate. That w3c validator sais
something about block elements in inline elements. As I understand it
<p><form></form></p> is valid or am I wrong ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
</head>
<body>
<div id = "testx">
<p>
text<br />

Is this supposed to be />
<form action="index.php" method="post">
veld:<br />
<input type="text" name="field" id="field"><br \>
or like this \>?
 
A

Arjen

Ed said:
Arjen scribed:
Is this supposed to be />
or like this \>?

Hi Ed,

Hmm that's a difficult one !
I guess again no points for typing :)

I dont think that's the problem. I just slimmed down the page to where
the errors began and made a typo.

It seems I cant put a form element into a div. This is a problem for me
since the divs are assigned in my framework and not specifically in
order of creation. That is sorted out later. So I have no good way of
nesting the forms as I dont know where and when they will turn up in
advance.

for example
$htlml->addhtml('x','y');
$htlml->addhtml('a','b');
$htlml->addhtml('z','y');

might output

<div id="a">
b
</div>
<div id="y">
x
z
</div>

any ideas ???

Arjen

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
</head>
<body>
<div id = "testx">
<form action="index.php" method="post">
<input type="text" name="field" id="field">
</form>
</div>
</body>
</html>

wont validate either
 
A

Andy Dingley

Arjen said:
Hi, this piece of html doesn;t validate. That w3c validator sais
something about block elements in inline elements. As I understand it
<p><form></form></p> is valid or am I wrong ?

Invalid.

There's no such thing as a simple "block element" (I've made a couple
of postings on this in the last couple of weeks). There are elements
that are _members_of_ block, and elements that can _contain_ block. One
doesn't imply the other, and <p> is the obvious example. <p> acts like
block itself, but it can only contain inline.
 
A

Arjen

Andy said:
Invalid.

There's no such thing as a simple "block element" (I've made a couple
of postings on this in the last couple of weeks). There are elements
that are _members_of_ block, and elements that can _contain_ block. One
doesn't imply the other, and <p> is the obvious example. <p> acts like
block itself, but it can only contain inline.

Hi Andy,

Thx for your reply.

I have no idea what you mean. I didnt even know there was such a thing
as block and inline elements till a few hours ago :)

You are referring to your earlies posts. Ill loop them up first thing in
the morning. (it's 02:00 now and the screen is spinning) and ill try to
figure it out.

Thx

Arjen
 
C

cwdjrxyz

Arjen said:
Hi, this piece of html doesn;t validate. That w3c validator sais
something about block elements in inline elements. As I understand it
<p><form></form></p> is valid or am I wrong ?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
</head>
<body>
<div id = "testx">
<p>
text<br />
<form action="index.php" method="post">
veld:<br />
<input type="text" name="field" id="field"><br \>
<input type="submit" id="submitid" value="Submit" />
</form>
</p>
</div>
</body>
</html>

I will leave it to others to explain in detail why your form had
validation problems - there were several error messages in fact.
However see http://www.cwdjr.info/test/formtest.html for a modified
version of your test page that does validate at W3C as xhtml 1.0
strict. You may need to reformat it a bit to display exactly as you
wish on the page. Note that the validator is much more strict for a
xhtml page than a html 4.01 strict page, and you often can get away
with much more in html without validator error messages. Are you
actually planning to serve the page as true xhtml, with your server set
up with perhaps .xhtml associated with the mime type
application/xhtml+xml ? If you just serve it as usual with the html
extension, your page just gets served as text/html normal html despite
the xhtml Doctype. But if you do serve as true xhtml with the mentioned
mime type, IE6 will not view true xhtml. This would require a separate
html 4.01 strict page for IE6 and a convenient method for selecting it
when needed. This would require some server side code such as php or
something else to modify the code or redirect to another page when an
html page is needed for IE6 and some early browsers.

Note that my example page is being served as .html because that is how
I assumed you wished to do it because of the your extension .html
rather than .xtml or .xml. Doing it this way, you might as well write
the page as html 4.01 strict because the page is only going to be
served as html - not xhtml or xml - anyway.
 
A

Arjen

I will leave it to others to explain in detail why your form had
validation problems - there were several error messages in fact.
However see http://www.cwdjr.info/test/formtest.html for a modified
version of your test page that does validate at W3C as xhtml 1.0
strict.

> You may need to reformat it a bit to display exactly as you
wish on the page. Note that the validator is much more strict for a
xhtml page than a html 4.01 strict page, and you often can get away
with much more in html without validator error messages. Are you
actually planning to serve the page as true xhtml, with your server set
up with perhaps .xhtml associated with the mime type
application/xhtml+xml ?

Actually all files will have the php extention. Im letting a friend do
the server settings so I really dont know about the server associated
mime type. The framework generates most stuf automatically in xhtml
strict. That's why I try to use it. I guess I can send the output buffer
thru another template wich will output html 4.01
Note that my example page is being served as .html because that is how
I assumed you wished to do it because of the your extension .html
rather than .xtml or .xml. Doing it this way, you might as well write
the page as html 4.01 strict because the page is only going to be
served as html - not xhtml or xml - anyway.

I dont remember saying I used th html extention. Did I miss something ?

Anyway im really glad with your help !

Thx

Arjen
 
A

Andy Dingley

Arjen said:
I have no idea what you mean. I didnt even know there was such a thing
as block and inline elements till a few hours ago :)

In that case, abandon the XHTML and use HTML 4.01 Strict instead.

XHTML has almost nothing to offer, and it's hard to use it correctly.
Best avoided unless you know you need it, and why.
 
A

Arjen

Andy said:
In that case, abandon the XHTML and use HTML 4.01 Strict instead.

XHTML has almost nothing to offer, and it's hard to use it correctly.
Best avoided unless you know you need it, and why.

I'd like to but the framework generates XHTML. So im stuck with it and
i'd better learn fast :) I thought I had figured out most differences
between HTML 4 AND XHTML 1 but I guess I didn't really.

As it turns out I know the difference between block and inline elements
(sorta) but it was implicit knowledge. Ill figure it out :)

Thx for your reply and I read your posts wich were interesting

Arjen
 
A

Andy Dingley

Arjen said:
I'd like to but the framework generates XHTML.

Bitter experience suggests that the framework will then be broken and
will grossly mis-use XHTML too! There's no reason it should force
the output to be XHTML, even if it's used internally by the CMS. There
are very good reasons why any competent framework must be able to offer
HTML as an output choice.

If you do use XHTML (and you certainly can), then you're force into
using Appendix C and serving is as text/html.
 
C

cwdjrxyz

Arjen said:
Actually all files will have the php extention. Im letting a friend do
the server settings so I really dont know about the server associated
mime type. The framework generates most stuf automatically in xhtml
strict. That's why I try to use it. I guess I can send the output buffer
thru another template wich will output html 4.01

To tell how a page is servered, go to the W3C validator and select the
extended interface. Then check the "show source" and "verbose output"
boxes. Enter the page URL and validate. Near the top of the page you
will see Content-type. For an html page you get text/html; for xhtml
you get application/xhtml+xml; for an xml page you get application/xml.
This is how the page is actually served. Now test the page I gave you
in a previous post served as .html. Next test the page
http://www.cwdjr.info/test/formtestXML.xml that is served as xml by
setting the mime type for application/xml for the extension .xml on the
server. Next test the page http://www.cwdjr.info/test/formtestX.xhtml
that is served by setting the mime type for application/xhtml+xml on
the server to correspond to the extension .xhtml.

Now try the mentioned pages on recent Mozilla family browsers(Firefox,
Mozilla, Netscape, Mozilla) and Opera. All 3 pages work. Then try the 3
pages on IE6. The page works only when served as .html. The pages
served as .xhtml or .xml can not be handled. In this case you just get
the source code displayed on IE6. In other cases you get an error
message on IE6.

A page with the .php extension will get served as usually one of the 3
types mentioned above and the content-type on extended interface
validation at the W3C will tell you how the php page is being served.

If a page views properly on IE6, it is not being served as true xhtml
or xml.
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top