Forum Home
Press F1
 
Thread ID: 113609 2010-10-28 02:03:00 Html to Xhtml questions Morgenmuffel (187) Press F1
Post ID Timestamp Content User
1148219 2010-10-28 02:03:00 Ok I am getting through this slowly, I don't expect the pages to validate 100% but under 40 errors a page would be an improvement

doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1 . 0 Strict//EN" " . w3 . org/TR/xhtml1/DTD/xhtml1-strict . dtd">" target="_blank">www . w3 . org
<html xmlns=" . w3 . org/1999/xhtml">" target="_blank">www . w3 . org
<head>

anyway when validating

Error One

The name attribute

I am using forms and i keep getting an error

there is no attribute "name"

on the <form> tag,

so if i name the id attribute the same as the form name it should work?
actual code is shown below in next problem


Error Two

document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag



<div id="tps">
<div id="tps3">
<form action="/search . php" method="post" name="form1" id="form">
SEARCH
<input name="search" type="text" class="searchbox"/>
<input name="thumbnails" type="hidden" id="thumbnails" value="yes"/>
<input type="submit" name="Search" value="GO"/>
</form>
</div>
</div>

This i don't get, the Inputs are enclosed in Div tags so i shouldn't get an error

Error three

Is also caused by the above code specifically the word "Search"



character data is not allowed here
SEARCH



You have used character data somewhere it is not permitted to appear . Mistakes that can cause this error include:
putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or
forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or
using XHTML-style self-closing tags (such as <meta . . . />) in HTML 4 . 01 or earlier . To fix, remove the extra slash ('/') character . For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML .


Any help appreciated as i am a touch stumped
Morgenmuffel (187)
1148220 2010-10-28 02:06:00 What doctype have you declared at the top of the page? inphinity (7274)
1148221 2010-10-28 02:12:00 I have just added it to the original post, i knew someone would ask Morgenmuffel (187)
1148222 2010-10-28 02:24:00 XHTML strict doesn't allow unwrapped text or <input> tags; wrap them in something and your problems will go...

It's also worth pointing out that wasting time making your page validate perfectly is somewhat pointless, unless you're in the mood for killing time - provided your code is reasonably sane, easily understood by whoever needs to maintain it next time, and renders properly in all major browsers, that's all you really need.

Note also that strict adherence to the standards will sometimes cause more problems than it solves.
Erayd (23)
1148223 2010-10-28 02:32:00 XHTML strict doesn't allow unwrapped text or <input> tags; wrap them in something and your problems will go...

It's also worth pointing out that wasting time making your page validate perfectly is somewhat pointless, unless you're in the mood for killing time - provided your code is reasonably sane, easily understood by whoever needs to maintain it next time, and renders properly in all major browsers, that's all you really need.

Note also that strict adherence to the standards will sometimes cause more problems than it solves.

I do agree, however these ones are on every single page and provided its fairly simple i'd like to get rid of them, also as it will help me learn a bot about xhtml that i didn't know, and quite frankly i'd like to leave the site better than when i found it

anyway does that mean i have to wrap everysingle one of those input tags plus the text

eg somthing like



<div id="tps">
<div id="tps3">
<form action="/search.php" method="post" name="form1" id="form">
<span>SEARCH</span>
<span><input name="search" type="text" class="searchbox"/></span>
<span><input name="thumbnails" type="hidden" id="thumbnails" value="yes"/></span>
<span><input type="submit" name="Search" value="GO"/></span>
</form>
</div>
</div>
Morgenmuffel (187)
1148224 2010-10-28 02:46:00 Not quite - if I recall correctly, simply sticking a single <div> inside the form but outside the inputs and text should be enough - basically anything that avoids them being direct children of the form. If I've remembered wrongly, the w3 parser should tell you what's required.

Note also that span isn't a block element (unless you take the counter-intuitive approach and style it that way); it shouldn't really be used as such unless you're intending to confuse people.
Erayd (23)
1148225 2010-10-28 02:57:00 Cheers I'll try this



<div id="tps">
<form action="/search.php" method="post" name="form1" id="form">
<div id="tps3">
SEARCH
<input name="search" type="text" class="searchbox"/>
<input name="thumbnails" type="hidden" id="thumbnails" value="yes"/>
<input type="submit" name="Search" value="GO"/>
</div>
</form>
</div>
Morgenmuffel (187)
1