...

View Full Version : Still getting a validation error...



outofcrayons
07-19-2011, 07:14 PM
This is for an assignment in school. All of our HTML has to be W3C validated. I'm still getting one error. On line 32 specifically. This is what it's saying:

"Line 32, Column 43: end tag for "select" which is not finished
<select name="choiceBox" size="7"></select>✉
Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; <dl> requires <dt> and <dd>), and so on."

I don't see anything nested incorrectly. I've been hacking at the code for a while now with no solution. Anyone have any ideas?


<table border="0">
<tr>
<td valign="top">
<h3>Personal Information</h3>
<p>Name<br />
<input type="text" name="name" size="50" onclick="document.forms[0].name.value = '';" /></p>
<p>E-mail<br />
<input type="text" name="e_mail" size="50" onclick="document.forms[0].e_mail.value = '';" /></p>
</td>
</tr>
<tr>
<td valign="top">
<p>Are you 18 years of age or older?</p>
<p><input type="radio" name="preferences" />Yes</p>
<p><input type="radio" name="preferences" />No</p>
</td>
</tr>
<tr>
<td valign="top">
<p>Positions interested in:</p>
<select name="available" size="7" onchange="moveOver();">
<option>Server</option>
<option>Host</option>
<option>Food Runner</option>
<option>Line Cook</option>
<option>Manager</option>
<option>Busser</option>
<option>Event Coordinator</option>
</select>

<p>Your Choices:</p>
<select name="choiceBox" size="7"></select>

<p><input type="button" value="Remove" onclick="removeMe();" /></p>
</td>
</tr>
</table>

alykins
07-19-2011, 07:20 PM
Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; <dl> requires <dt> and <dd>), and so on."

emphasis on


an element which requires a child element that you did not include.

add an option and it passes :)

outofcrayons
07-19-2011, 07:23 PM
I don't need any options though. The job positions the user selects will appear in that box. I tried to do <option></option> but that just messed it up.

alykins
07-19-2011, 07:32 PM
then i think you are misusing the <select> tag... are you trying to pass the selection to a DB and on postback return what they clicked?

outofcrayons
07-19-2011, 07:33 PM
It is attached to a form processor page so I think the answer to your question is yes. The user should also be allowed to select what shows up and remove it as well. I hope that makes sense.

alykins
07-19-2011, 07:46 PM
what are your secondary languages? (ie are you using php or asp and what is your DB? and if asp C# or VB?)... better yet, can you post all your code... will make life a lot easier. i think though this thread will need to be moved to the appropriate forum section, but still will need that info and pending what is there may get answer here anyways :)

outofcrayons
07-19-2011, 07:48 PM
The secondary is JavaScript. Thanks for your help. Here is the 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" xml:lang="en" lang="en">
<head>
<title>
Employment Application
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<link rel="stylesheet" href="js_styles.css" type="text/css" />
<script type="text/javascript">
/* <![CDATA[ */
function moveOver()
{
var boxLength = document.choiceForm.choiceBox.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText = document.choiceForm.available.options[selectedItem].text;
var selectedValue = document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.choiceBox.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.choiceBox.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
}
function removeMe() {
var boxLength = document.choiceForm.choiceBox.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.choiceForm.choiceBox.options[i].selected) {
arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
document.choiceForm.choiceBox.options[i] = null;
}
}
boxLength = document.choiceForm.choiceBox.length;
}
}
function confirmSubmit() {
if (document.forms[0].name.value == '') {
window.alert("You have not entered the requested personal information.");
return false;
}
else if (document.forms[0].e_mail.value == '') {
window.alert("You have not entered an e-mail address.");
return false;
}
}
function confirmReset() {
var resetForm = window.confirm("Are you sure you want to reset the form?");
if (resetForm == true)
return true;
return false;
}
/* ]]> */
</script>
</head>
<body>
<div id="instructions">
<h2>Employment Application</h2>
<form action="FormProcessor.html" method="post" enctype="application/x-www-form-urlencoded" name="choiceForm" id="choiceForm" onsubmit="return confirmSubmit();" onreset="return confirmReset();">
<table border="0">
<tr>
<td valign="top">
<h3>Personal Information</h3>
<p>Name<br />
<input type="text" name="name" size="50" onclick="document.forms[0].name.value = '';" /></p>
<p>E-mail<br />
<input type="text" name="e_mail" size="50" onclick="document.forms[0].e_mail.value = '';" /></p>
</td>
</tr>
<tr>
<td valign="top">
<p>Are you 18 years of age or older?</p>
<p><input type="radio" name="preferences" />Yes</p>
<p><input type="radio" name="preferences" />No</p>
</td>
</tr>
<tr>
<td valign="top">
<p>Positions interested in:</p>
<select name="available" size="7" onchange="moveOver();">
<option>Server</option>
<option>Host</option>
<option>Food Runner</option>
<option>Line Cook</option>
<option>Manager</option>
<option>Busser</option>
<option>Event Coordinator</option>
</select>

<p>Your Choices:</p>
<select name="choiceBox" size="7"></select>

<p><input type="button" value="Remove" onclick="removeMe();" /></p>
</td>
</tr>
</table>
<p><input type="image" alt="Graphical image of a subscribe button" src="../assignment9/subscribe.png" /></p>
<p><input type="reset" value="Reset Registration Form" onchange="confirmReset" /></p>
</form>

</div>

<p>
<a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" height="31" width="88" style="border: 0px;" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"> <img src="http://www.austincc.edu/jscholl/images/vcss.png"
alt="Valid CSS!" height="31" width="88" style="border: 0px;" /></a>
</p>

</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum