Click to See Complete Forum and Search --> : Validation Problems
Zach Elfers
02-12-2003, 02:50 PM
I am new to XHTML and have made a site. I tried to validate my XHTML page width W3C's validator, but got some errors. I am having trouble fixing them.
I have a menu with links. I don't like the dotted outline, so I have:
<a class="menuLink" href="contact.html" onFocus="this.blur();">Text</a>
The validator is saying that there is a problem with the event handler "onFocus".
I also have a form with an "onSubmit" handler. This also gets errors.
At the end of the form, of course, of close it with </form>. The validator is saying that the form isn't open and it generates an error.
Also, throughout my XHTML page I have used <p>. This always generates an error.
I want a valid page. Can someone please help me fix these problems?
Charles
02-12-2003, 03:03 PM
That's because the names of all of the event handlers are all lower case and always have been. It's only because HTML is case insensitive that you haven't noticed this before.
Zach Elfers
02-12-2003, 03:09 PM
Thanks Charles.
Charles
02-12-2003, 03:18 PM
Your welcome. But please note that I have several times received an upbraiding on this board for pointing out that onClick is problematic.
As to you other issues, please post the URL. It sounds like you've got some major tree errors there.
spufi
02-12-2003, 09:48 PM
Without having the code tp look at, could your <p> problem be due to the fact that you don't have any, or enough </p> tags?
Zach Elfers
02-13-2003, 09:02 AM
I have included slide-show.html and contact.html since these pages generate the most errors. Here is slide-show.html:
Zach Elfers
02-13-2003, 09:03 AM
Here's the next file:
spufi
02-13-2003, 09:35 AM
<?xml version="1.0" encoding="utf-8"?>
You can get rid of that line. It's technically isn't needed, and I believe IE has issues with it.
You have a <p> tag before your <iframe> tag, but no closing </p> tag after it.
Your inner table has both opening and closing <p> tags around it. Get rid of those and your slide-show page should validate.
And speaking of nested tables.... :)
I'll weed through the other file now.
Zach Elfers
02-13-2003, 09:38 AM
Ok I will start fixing slide-show.html.
Charles
02-13-2003, 09:40 AM
It's kind of hard to say just what's going on there. You have some unclosed P tags. Remember, the P element cannot contain block elements and I think that that is causing trouble. And your use of nested tables is bad, very bad.
You should be using XHTML 1.0 strict or XHTML 1.1 and you ought never to be using tables for layout.
Zach Elfers
02-13-2003, 09:41 AM
Slide-show is now valid! Thanks spufi.
spufi
02-13-2003, 09:42 AM
For your contact page, your form tag is incorrect. You coded the opening tag like it's an empty tag and then you included the closing tag. Change the opening tag to where it's just an opening tag.
Zach Elfers
02-13-2003, 09:45 AM
Originally posted by Charles
It's kind of hard to say just what's going on there. You have some unclosed P tags. Remember, the P element cannot contain block elements and I think that that is causing trouble. And your use of nested tables is bad, very bad.
You should be using XHTML 1.0 strict or XHTML 1.1 and you ought never to be using tables for layout.
I will work on the <p> tags.
What is wrong with using tables for layout? The reason I am using them, is because my menu is a div and my main content is within a div. Since div's are blocklevel, there would be the menu, then at the bottom would the main content begin. I tried changing the div's block level by adding display:inline; but that didn't work. So I decided to use tables. I can use the divs with the tables and everything looks fine. How would I keep the page looking the same without using tables?
Zach Elfers
02-13-2003, 09:51 AM
Thanks Charles and Spufi. My whole page is valid EXCEPT for one page. When I go to validate it, it says that the validator can't validate it because the page contains characters which don't correspond with its character encoding or something like that. I can't understand what could be causing this error so maybe you could help.
Charles
02-13-2003, 09:53 AM
Originally posted by Zach Elfers
What is wrong with using tables for layout?From the HTML 4.01 Specification
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.If you want to see how it's properly done then take a look at Mr. Rick Bull's admirable site at http://www.rickbull.co.uk/. There is much there to emulate.
spufi
02-13-2003, 10:03 AM
I have a feeling I know why this page doesn't validate. Put this <meta> tag in for the charset. You should have one on every page. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Since I got rid of the <xml> tag on your one page it had the charset defined in it. Second, this is were Mozilla rocks over IE. Maybe Netscape does this too, but what you need to do is retype in your apostrophes. In Mozilla, the browser makes it obvious where these changes need to be made.
Zach Elfers
02-13-2003, 10:06 AM
Ok. I didn't have that tag added because I assumed that the <xml> tag would take care of it. Should I get rid of the XML tag and just use the meta tag, or should I add both?
Zach Elfers
02-13-2003, 10:09 AM
I see what you mean about the single quotes. They are appearing as ? marks.
spufi
02-13-2003, 10:11 AM
I believe IE has issues with the <xml> tag which contains your charset definition. <?xml version="1.0" encoding="utf-8"?> When you get rid of it, you'll need to define it elsewhere. Doing it in the <meta> covers it. So you only need it in the <meta> tag and not in both places.
Zach Elfers
02-13-2003, 10:16 AM
I used both tags. Now it validates, but with errors. I am working on it. Thanks for all your help! This is my first XHTML page, so next time I will know how to fix most errors when I validate it.
Zach Elfers
02-13-2003, 10:21 AM
All my pages are valid. I am not having any trouble anymore. I fixed the blurbs page.
Robert Wellock
02-13-2003, 10:25 AM
It cannot validate because you have curly quotes Elfers’ which is not UTF-8 in that state kill the curly quotes and use notepad to do ' not ’.
Zach Elfers
02-13-2003, 10:29 AM
It's already fixed. I used & + rsquo; to make my quotes. I should have noticed that. I copy and pasted those paragraph's from the publishers page where the blurbs were (they were also on the back of the book but it was faster through the publishers page). It's such an obvious mistake.:D
Stefan
02-14-2003, 08:29 AM
Originally posted by spufi
I believe IE has issues with the <xml> tag which contains your charset definition. <?xml version="1.0" encoding="utf-8"?> When you get rid of it, you'll need to define it elsewhere.
For compability with older browsers, as long as you are sending the file a mimetype text/html you will always* need the metatag.
If you are sending the file as a real XML page old browsers (including IE 6) can't read the page at all anyway, so then the meta is not needed anymore :D
* = unless you got access to the server and can specify it in the HTTP heading