View Full Version : Getting a lot of errors when attempting to validate this form

06-05-2005, 07:53 AM
Howdy. I was directed here by a member from another forum who said this is the place to ask more advanced questions, so here goes:

I'm currently working on converting my HTML pages into XHTML - getting a jump start on the 'next big thing' in web design. It's going well except for one minor problem. I have a form that uses listboxes as a navigation method and the W3C Strict XHTML 1.0 validator is spitting out a whopping 405 errors regarding this form.

Could someone take a look at my code and tell me what I'm doing wrong? It'd be greatly appreciated.

The page is:


Here's the URL to the validator with all the options already inputted:


I hope I posted this in the right place - I checked the rules and all the FAQs. If not, could a mod/admin move this for me? Many thanks.

06-05-2005, 08:18 AM
Several of your problems are derived from not using quotes.

<select size=10
should be

<select size="10"


<option value=319.html class="b3">
should be

<option value="319.html" class="b3">

That should fix litterally a few hundered of the errors, after that post again and I'll take another look.

Edit: I almost forgot, welcome to the forums! This is truely a great place, just you wait and see.

06-05-2005, 09:50 AM
Edit: I almost forgot, welcome to the forums! This is truely a great place, just you wait and see.

Yeah, welcome to zeroality. Wooh, people are recommending us, they must like is :p

06-05-2005, 08:50 PM
Woohoo, down to 13 errors! Yeah, I can see that this is a great place. ^_^

Alright, go re-validate it and see what those 13 errors are about, if you could?

Many thanks.

06-05-2005, 09:06 PM
if you dont need the form name then just remove it otherwise use id
<form name="nav">

still missing some quotes
<select size="10" onchange=document.location.href=document.nav.Gen1.options[docu

06-05-2005, 09:11 PM
1. All form elements must have an action. <form action="something here">

2. Yup, still need quotes for javascript, onchange="somestuff"

06-05-2005, 09:19 PM
I'm currently working on converting my HTML pages into XHTML - getting a jump start on the 'next big thing' in web design.
Just to let you know, XHTML isn't the "next big thing" in web design as much as standards is. So I would put less stress into converting your site to XHTML (which is still being served as HTML (http://www.hixie.ch/advocacy/xhtml) anyway) and more into moving the site away from a nested table layout... essentially structuring your page a little more semantically.

But you're taking all the right steps, though... validation is a great place to start. :thumbsup:

06-05-2005, 09:47 PM
Alright, down to 4 errors. Yes - the forms need to have a name, that's how the javascript works.

See the form name is "nav2" and the script is like: onchange="document.location.href=document.nav2.Gen2.options[document.nav2.Gen2.selectedIndex].value"

So how do I make it stop giving errors?

As for adding actions, what should I add? I don't think that's it. The validator is just complaining about the 'name' parameter.

To rmedek - I read somewhere that HTML was becoming outdated so I decided to just switch to XHTML.

As for using tables - yeah, I've already been lectured on that. The problem is, I have 400 pages already laid out in tables and converting it to div would be a major pain.

I like tables anyway - hey, at least I'm not using FRAMES anymore! LOL. I had a whole site made with inline frames. :eek:

06-05-2005, 10:03 PM
Alright, I added a blank action to all of them. That got rid of the action errors.

Now what about the name?

06-05-2005, 10:32 PM
just delete the name. It doesn't do anything....

06-05-2005, 10:37 PM
That removes the functionality.

So yes, it does do something. :)

I've tried

<form="nav" action="">

<form id="nav" action="">

<form action="">

They validate fine but the form loses functionality. The only thing that seems to work so far is:

<form name="nav" action="">

I might have to live with the 3 errors but would like to get it fixed.

06-06-2005, 12:20 AM
Woah.. I never knew there was a 3rd generation to pokemon.

06-06-2005, 12:24 AM
Im confused, what is the name for, are you using that to refer to it in your css?

06-06-2005, 12:40 AM
<form name="nav" action="">

<select size="10" onchange="document.location.href=document.nav.Gen1.options[document.nav.Gen1.selectedIndex].value" name="Gen1">

See the document.nav.Gen1 ? Without the name, it doesn't know which form the code is referring to since I have 3 of them.

<form name="nav2" action="">

<select size="10" onchange="document.location.href=document.nav2.Gen2.options[document.nav2.Gen2.selectedIndex].value" name="Gen2">

And so forth..

06-06-2005, 12:52 AM
this might work, haven't tested but its a good possibility. Try

<form name="nav" action="">

<select size="10" onchange="document.location.href=this.form.Gen1.options[document.nav.Gen1.selectedIndex].value" name="Gen1">

You might be better off using the bracket notation. Glenng has some good documentation about this. For the first form. You can start with 0 then the forms after that go in subsequent order, so your nav2 would be document.forms[1].Gen2. etc.

<form name="nav" action="">

<select size="10" onchange="document.location.href=document.forms[0].Gen1.options[document.nav.Gen1.selectedIndex].value" name="Gen1">
You could lose the name for both instances.

06-06-2005, 01:03 AM
<form action="">

<select size="10" onchange="document.location.href=document.forms[0].Gen1.options[document.nav.Gen1.selectedIndex].value" name="Gen1">

That don't work. Neither did this:

<form action="">

<select size="10" onchange="document.location.href=document.this.form.Gen1.options[document.nav.Gen1.selectedIndex].value" name="Gen1">

Note that I don't know javascript, per se. A friend gave me that script and I can't ask him because his computer went fubar. :(

So any recommendations will have to be in the form of literal code - not 'suggestions'.

06-06-2005, 01:06 AM
This should work.

<form action="">

<select size="10" onchange="document.location.href=this.form.Gen1.options[this.form.Gen1.selectedIndex].value" name="Gen1">
Notice the lack of the word document before it. You also need to change it in the other places where you used the form name.
This also works.

<form method="post" action="">
<select size="10" onchange="document.location.href=document.forms[0].Gen1.options[document.forms[0].Gen1.selectedIndex].value" name="Gen1">

Since its the first form on the page you start with 0 the next form will have a 1 and so forth. You might be better off just using this.form it will spare you the time of counting which form it is.

06-06-2005, 01:10 AM
...and if that still doesn't work, perhaps this might...

<form id="nav" action="">

<select size="10" onchange="document.location.href=document.getElementById('nav').Gen1.options[document.getElementById('nav').Gen1.selectedIndex].value" name="Gen1">

Please note that Aerospace's suggestion is a cleaner solution and is preferable.

06-06-2005, 01:21 AM
Awesome! Thanks mindlesslemming, I used the getElement code.

Seriously. Thanks so much y'all! I tried getting this resolved in another forum but all they did was make snide comments on the semantics of my site. >_>

I'll definitely come here for all future problems and recommend this forum to everyone! Thanks again. Have a great day y'all!

06-06-2005, 01:37 AM
Sighs, my suggestions were ideal. Not every browser supports getElementById. I even gave you the examples. I even tested your site on my local machine using the methods I was telling you to use and they worked.

06-06-2005, 03:43 AM
You're right, I tried it in another browser and it didnt' work.

I used yours instead, thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum