Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Why doesn't this form validate ?

Reply
Thread Tools

Why doesn't this form validate ?

 
 
Arjen
Guest
Posts: n/a
 
      10-13-2006
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>
 
Reply With Quote
 
 
 
 
Ed Jay
Guest
Posts: n/a
 
      10-13-2006
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 \>?

><input type="submit" id="submitid" value="Submit" />
></form>
></p>
></div>
></body>
></html>

--
Ed Jay (remove 'M' to respond by email)
 
Reply With Quote
 
 
 
 
Arjen
Guest
Posts: n/a
 
      10-13-2006
Ed Jay wrote:
> 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
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      10-13-2006

Arjen wrote:

> 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.

 
Reply With Quote
 
Arjen
Guest
Posts: n/a
 
      10-13-2006
Andy Dingley wrote:
> Arjen wrote:
>
>> 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.


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



 
Reply With Quote
 
cwdjrxyz
Guest
Posts: n/a
 
      10-14-2006

Arjen wrote:
> 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.

 
Reply With Quote
 
Ed Seedhouse
Guest
Posts: n/a
 
      10-14-2006
On Sat, 14 Oct 2006 00:51:19 +0200, Arjen <> wrote:

> As I understand it
><p><form></form></p> is valid or am I wrong ?


You are wrong. <p> cannot contain other block elements.

 
Reply With Quote
 
Arjen
Guest
Posts: n/a
 
      10-14-2006
> 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.


Cool thx ! <div><form><p>stuf</p></form</div>


> 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
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      10-14-2006

Arjen wrote:

> 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.

 
Reply With Quote
 
Arjen
Guest
Posts: n/a
 
      10-14-2006
Andy Dingley wrote:
> Arjen wrote:
>
>> 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.


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
submit form, validate form, set cookie, send email, download file mhawkins19@adelphia.net Javascript 1 03-17-2005 08:19 AM
Validate form =?Utf-8?B?UmFqYW5p?= ASP .Net 1 11-13-2004 08:01 AM
form wont validate on remote server Jack Wheeler ASP .Net 1 06-14-2004 09:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57