...

View Full Version : Resolved Xhtml validation error



andrewjs18
11-21-2008, 08:18 PM
Well, I'm still fairly new to xhtml and have been doing a good job at correcting errors, but I'm stumped as to why my code keeps failing a recent validation.

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.ugly-cars.com%2Ftest%2Fcontact.html&charset=(detect+automatically)&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.606

Here's my code:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Webfinity Design-Contact Us | Contact us for our services...</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body
{
width: 768px;
}

#form
{
position: relative;
top: 150px;
left: 50px;
width: 300px;
text-align: left;
}

.submit li
{
position: relative;
top: 200px;
left: 70px;
}

.info
{
position: relative;
top: 100px;
left: 70px;
width: 550px;
background-color:#ACD095;
text-align: center;
padding:10px;
border:solid thin #167A58;
}

ul
{
list-style: none;
}
</style>
<script type="text/javascript">
function validate_fields(thisform)
{

if (thisform.company.value == "" || thisform.company.value == null)
{
alert("Please enter your company's name");
return false;
}
if (thisform.phone.value == "" || thisform.phone.value == null)
{
alert("Please enter your phone number");
return false;
}
if (thisform.email.value == "" || thisform.email.value == null)
{
alert("Please provide an email address");
return false;
}
if (thisform.comments.value == "" || thisform.comments.value == null)
{
alert("Please provide us with some comments");
return false;
}
}
function setstyle(x)
{
document.getElementById(x).style.background="#FFCC33";
}
function loseStyle(x)
{
document.getElementById(x).style.background="white";
}
</script>
</head>
<body>
<p class="info">Please fill this form out for us to process your request.<br />
We only build sites that require more than 3 pages unless you're requesting graphics works.<br />
If you have any images you want us to use, please feel free to take advantage of our upload funtion on this page.
</p>

<form name="form" action="contact.php" method="post" onsubmit="return validate_fields(this)" />
<div id="form">
<ul>
<li>Company Name:<br />
<input type="text" onfocus="setstyle(this.id)" name="company" id="company" onblur="loseStyle(this.id)" /></li>
<li>Phone #:<br />
<input type="text" onfocus="setstyle(this.id)" name="phone" id="phone" onblur="loseStyle(this.id)" /></li>
<li>Email:<br />
<input type="text" onfocus="setstyle(this.id)" name="email" id="email" onblur="loseStyle(this.id)" /></li>
<li>Work Type:<br />
<select name="work">
<option value="website">Website</option>
<option value="graphics">Graphics</option>
</select></li>
<li>Number of Pages: <br />
<select name="page">
<option value="0">0 (Graphics)</option>
<option value="3">3 ($255 Minimum)</option>
<option value="4">4 ($340)</option>
<option value="5">5 ($425)</option>
<option value="6">6 ($510)</option>
<option value="7">7+ ($595+)</option>
</select></li>
<li>Referral: <br />
<input type="text" onfocus="setstyle(this.id)" name="referral" id="referral" onblur="loseStyle(this.id)" /></li>
<li>We allow the following formats: .jpg, .jpeg, .gif, .bmp, .png, .psd, .zip, .rar <br />
<input type="file" name="upload" value="Browse" /></li>
<li>Comments: <br />
Please post any questions or comments you have for us to answer about our services and/or information regarding your website. <br />
<textarea onfocus="setstyle(this.id)" name="comments" id="comments" onblur="loseStyle(this.id)" rows="5" cols="45"></textarea></li>
<li><input type="submit" name="submit" value="Submit" />
&nbsp;
<input type="reset" name="reset" value="Reset" /></li>
</ul>
</div>
</form>
</body>
</html>


Thanks,
Andrew

fishluvr
11-21-2008, 09:59 PM
One thing that jumped out upon a quick glance:


<form name="form" action="contact.php" method="post" onsubmit="return validate_fields(this)" />

andrewjs18
11-21-2008, 11:05 PM
One thing that jumped out upon a quick glance:


<form name="form" action="contact.php" method="post" onsubmit="return validate_fields(this)" />

Ah, I found it.

I closed the tag this way:
/> instead of simply like this:
>

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum