Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

W3C validation errors


Stealth1

Recommended Posts

Trying to sort out a couple final errors and hoping someone can help me out.

 

HTML 4.01 Transitional

 

First Error is below which is related to the .ico file which I have at the very bottom of my header.php file. This is the only way I can get the .ico to display on every page of the site, otherwise it needs to go inside every single page in the <head> section.

 

# Error  Line 26, Column 45: document type does not allow element "LINK" here

<link rel="shortcut icon" href="/TTicon.ico"><!-- header_eof //-->

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

 

The second error is located in /includes/boxes/search.php I believe but there is no border="0" in there so i'm completely stumped as to why it's showing as an error.

 

# Error  Line 110, Column 331: Attribute "BORDER" is not a valid attribute. Did you mean "border"?

…ttons/button_quick_find.gif" border="0" alt="Search" title=" Search "><br><a 

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

 

The last error is from the below section of code, I know that something needs to be removed from the line but I can't figure it out.

 

<a href=\"" . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'NONSSL') . "\">" . BOX_LOGINBOX_FORGOT_PASSWORD . "</a>

 

document type does not allow element "A" here

…hp"><a href="password_forgotten.php"><i>(Forgot password?)</i></a></a>

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Link to comment
Share on other sites

The link for the favicon needs to be in the <head> section of your page. Are you saying you have it in the body of your page? It should be before </head>. By the way, if you move/rename the file to /favicon.ico, any browser will find it without adding the <link> tag. It's ICON format, right?

 

For the second problem, are you saying that the validator is adding border="0" to your <img> tag? It is an image tag, isn't it? I don't think "border" is allowed with other kinds of image-related tags, such as <input> and <map> tags. What is the full statement that it's objecting to?

 

For the third problem, it appears you have a link (<a>) nested within another link. I see two </a></a>. Did you mean to have two links next to each other? Again, seeing the full context would be helpful.

Link to comment
Share on other sites

The link for the favicon needs to be in the <head> section of your page. Are you saying you have it in the body of your page? It should be before </head>. By the way, if you move/rename the file to /favicon.ico, any browser will find it without adding the <link> tag. It's ICON format, right?

 

Thanks for this, I had read that having just the file in the root sometimes wouldn't show in browsers but it appears to be working fine so I guess that was old info. I actually had it called in the header.php file at the very bottom as that is loaded on every page so I only had to put it in once to have the icon for every page.

Link to comment
Share on other sites

For the second problem, are you saying that the validator is adding border="0" to your <img> tag? It is an image tag, isn't it? I don't think "border" is allowed with other kinds of image-related tags, such as <input> and <map> tags. What is the full statement that it's objecting to?

 

Here is the line which it is referring to, this is located in /store/includes/boxes/search.php, I've highlighted where the part is that it is referring to.

 

                               'text' => tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . [b]tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '<br>[/b]<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a>');

 

Error

# Error  Line 110, Column 331: Attribute "BORDER" is not a valid attribute. Did you mean "border"?

…ttons/button_quick_find.gif" border="0" alt="Search" title=" Search "><br><a 

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Link to comment
Share on other sites

For the third problem, it appears you have a link (<a>) nested within another link. I see two </a></a>. Did you mean to have two links next to each other? Again, seeing the full context would be helpful.

 

I think I see the problem but not sure how to fix it now, it appears the link is called in the define aswell as in the box file.

 

store/includes/boxes/loginbox.php

                <td align=\"center\" class=\"infoBoxContents\">
                 <a href=\"" . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'NONSSL') . "\">" . BOX_LOGINBOX_FORGOT_PASSWORD . "</a>
               </td>

 

store/includes/languages/english/loginbox.php

  define('BOX_LOGINBOX_FORGOT_PASSWORD', '<a href="' . FILENAME_PASSWORD_FORGOTTEN . '"><i>(Forgot password?)</i></a>');

Link to comment
Share on other sites

I actually had it called in the header.php file at the very bottom as that is loaded on every page

"header.php" is within the <body>, long after the <head> has closed. Unfortunately, the way osC is written, the <head> section is hard-coded in every file. So if you put that <link> tag in header.php, it will show up in the <body>, and the validator will complain. A given browser may or may not properly display the icon.

Link to comment
Share on other sites

tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH)

I can see that the osC code is inserting border="0", into an <input type="image"... tag, which it shouldn't be. border="0" should not be output.

 

In includes/functions/html_output.php and admin/includes/functions/html_output.php,

// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
   global $language;

   $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';

should be changed to

// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
   global $language;

   $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" alt="' . tep_output_string($alt) . '"';

Link to comment
Share on other sites

store/includes/languages/english/loginbox.php

  define('BOX_LOGINBOX_FORGOT_PASSWORD', '<a href="' . FILENAME_PASSWORD_FORGOTTEN . '"><i>(Forgot password?)</i></a>');

should be

  define('BOX_LOGINBOX_FORGOT_PASSWORD', '<i>(Forgot password?)</i>');

Link to comment
Share on other sites

tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH)

I can see that the osC code is inserting border="0", into an <input type="image"... tag, which it shouldn't be. border="0" should not be output.

 

In includes/functions/html_output.php and admin/includes/functions/html_output.php,

// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
   global $language;

   $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';

should be changed to

// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
   global $language;

   $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" alt="' . tep_output_string($alt) . '"';

 

BINGO!

Link to comment
Share on other sites

And the last error is gone, thanks for that!

 

Going through some other sections now and finding errors.

 

   1.  Error  Line 45, Column 6: document type does not allow element "HEAD" here

     <head>

     The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

     One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

   2. Error Line 51, Column 40: document type does not allow element "BODY" here

     <body onload="getFocus('basicPinForm')">

     The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

     One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

   3. Error Line 273, Column 7: "HEAD" not finished but containing element ended

     </html>

 

   4. Error Line 273, Column 7: end tag for "HTML" which is not finished

     </html>

     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 (ul, ol, dl) require list items (li, or dt, dd), and so on.

Link to comment
Share on other sites

store/specials.php

  1.  Error  Line 193, Column 15: end tag for "TR" which is not finished

               </tr>

     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 (ul, ol, dl) require list items (li, or dt, dd), and so on.

 

Source Code

<?php
 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
     <tr>
       <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table></td>
     </tr>

Link to comment
Share on other sites

store/product_info.php

 

   1.  Error  Line 238, Column 13: end tag for "TABLE" omitted, but its declaration does not permit this

             </td>

         * You forgot to close a tag, or
         * you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

     The next message, "start tag was here" points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.
  2. Info Line 202, Column 161: start tag was here

     …tion=add_product" method="post">	    <table border="0" width="100%" cellspaci

 

   3. Error Line 238, Column 13: end tag for "FORM" omitted, but its declaration does not permit this

             </td>

         * You forgot to close a tag, or
         * you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

     The next message, "start tag was here" points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.
4. Info Line 202, Column 35: start tag was here

     	    <td width="100%" valign="top"><form name="cart_quantity" action="http://www

 

   5. Error Line 240, Column 19: end tag for element "FORM" which is not open

         </table></form></td>

     The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

     If this error occurred in a script section of your document, you should probably read this FAQ entry.

   6. Error Line 240, Column 24: end tag for element "TD" which is not open

         </table></form></td>

     The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

     If this error occurred in a script section of your document, you should probably read this FAQ entry.

   7. Error Line 242, Column 33: document type does not allow element "TD" here

         <td width="125" valign="top"><table border="0" width="125" cellspacing="0" c

     The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

     One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

   8. Error Line 382, Column 7: end tag for element "TR" which is not open

       </tr>

     The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

     If this error occurred in a script section of your document, you should probably read this FAQ entry.

   9. Error Line 383, Column 8: end tag for element "TABLE" which is not open

     </table>

     The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

     If this error occurred in a script section of your document, you should probably read this FAQ entry.

Link to comment
Share on other sites

store/popup_search_help.php

 

I have dealt with this error before but this one actually has values for the elements inside the body tag. If I remove these will the pages look be messed up and if so how do I fix this?

 

Error  Line 9, Column 19: Attribute "MARGINWIDTH" is not a valid attribute. Did you mean "marginwidth"?

<body marginwidth="10" marginheight="10" topmargin="10" bottommargin="10" leftma

Link to comment
Share on other sites

store/password_forgotten.php

 

   1.  Error  Line 188, Column 51: Attribute "HEIGHT" is not a valid attribute. Did you mean "height"?

     …able border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" cl

     You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

     This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

     How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Link to comment
Share on other sites

The W3C validator can get very confused if you inadvertently use XHTML-style "self-closing" tags, such as <br /> instead of <br>. This can lead to a whole cascade of spurious errors. Carefully go through the HTML as reported by the validator (not the PHP code) and look for the use of self-closing tags. Fix these and revalidate.

Link to comment
Share on other sites

store/create_account.php

 

   1.  Error  Line 365, Column 91: end tag for "SPAN" omitted, but its declaration does not permit this

     …utRequirement">*                </td>

         * You forgot to close a tag, or
         * you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

     The next message, "start tag was here" points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.
  2. Info Line 365, Column 38: start tag was here

     <input type="text" name="state"> <span class="inputRequirement">*   

Link to comment
Share on other sites

For this error W3C is pointing to this but I don't see what's wrong?

 

# <head>
# <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
# <title>Touge Tuning</title>
# <base href="https://www.tougetuning.com/upstore/">
# <link rel="stylesheet" type="text/css" href="stylesheet.css">
# </head>

 

   1.  Error  Line 45, Column 6: document type does not allow element "HEAD" here

     <head>

     The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

     One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Link to comment
Share on other sites

1. See if you are missing a </span> tag, or if the order of tags is wrong (<td><span>...</td></span>).

 

2. Do you have two <head> tags? You shouldn't. If you don't have two <head> tags, the validator doesn't like something appearing before <head> -- perhaps there's a tag that shouldn't be there? Only <html> and <!doctype> should come before <head>.

Link to comment
Share on other sites

1. See if you are missing a </span> tag, or if the order of tags is wrong (<td><span>...</td></span>).

 

2. Do you have two <head> tags? You shouldn't. If you don't have two <head> tags, the validator doesn't like something appearing before <head> -- perhaps there's a tag that shouldn't be there? Only <html> and <!doctype> should come before <head>.

 

I have the following code in there before the <head> tag, if I move it inside the <head> tag would this fix things or cause more issues?

 

<script type="text/javaScript" src='./js/zisa_popup.js'></script>
<script type="text/javascript">

function validate(input) {
if (input=="") return true;
var bad = "!?#$%^&*';:,~`<>\|[]{}()[email protected]";
var doubleQ = '"';
var okay = true;

if (input.indexOf(doubleQ)>-1) {
	okay = false;
}

for (i=0;i<=input.length;i++) {
	var c = input.substr(i,1);

	if (c!="" && bad.indexOf(c)>-1) {
		okay = false;
	}
}
return okay;
}

function submitPIN(obj) {
if (obj=="") return;
var formObj = eval("document." + obj);

if (!validate(formObj.temp_trkid1.value)) {
	alert('Invalid characters in the input fields. Please check your entries and try again.');
	return;
} 
if (formObj.temp_trkid1.value=="") {
	alert('No Item number was submitted. Please enter a number and click Submit.');
	return;
}
                  formObj.trackingId.value=formObj.temp_trkid1.value;
formObj.trackingCode.value='PIN';
formObj.submit();
}
</script>

Link to comment
Share on other sites

Do I need to delete or move the </a> in this line?

 

    <td height="30" class="headerNavigation">  <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: 155px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH). '</a></form>'; ?></td>

 

Error

f" alt="Search" title=" Search "></a></form></td>

The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem. 

Link to comment
Share on other sites

  • 11 months later...

I need help

 

Error: end tag for element "CENTER" which is not open

 

Code:

 

<script type="text/javascript">

<!--

/* merge server php and client javascript arrays */

var pausecontent_np=new Array();

pausecontent_np[0] = '<center><a href=\'http://www.prueba.org/product_info.php/colcha-blanca-algodon-listado-p-94\'><img src="product_thumb.php?img=images/colcha.jpg&w=133&h=100" width="133" height="100" border="0" alt="Colcha Blanca Algodon Listado" title="Colcha Blanca Algodon Listado"><br>Colcha Blanca Algodon Listado<br>+INFO</center><br><br>';

 

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...