View Full Version : Resolved Xhtml validation error

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.


Here's my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<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">
width: 768px;

position: relative;
top: 150px;
left: 50px;
width: 300px;
text-align: left;

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

position: relative;
top: 100px;
left: 70px;
width: 550px;
text-align: center;
border:solid thin #167A58;

list-style: none;
<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)
function loseStyle(x)
<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.

<form name="form" action="contact.php" method="post" onsubmit="return validate_fields(this)" />
<div id="form">
<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>
<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>
<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" />
<input type="reset" name="reset" value="Reset" /></li>


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)" />

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: