Small piece of code failing validation

jeanm

Member
I'm re-creating a web site and I'm using strict xhtml and checking each page through a validator as I go. I want each page to have no faults and I can manage that with code that I input.

However I want to have a link to a site which earns me some money when people visit there and buy what they have on offer. The html they supply me with obviously isn't strict xhtml so when I put this code on my pages they fail validation. Is there any way I can amend this code so it will meet validation and yet not muck things up so that I end up failing to make any money if someone does click on the link and buy.

This is the offending code:

<form action="http://www.simplesavings.com.au/a.php?a=235419" method="post">
<p>Show me <B>how to save money</B> on:
<select>
<option selected>Choose Selection</option>
<option>Nappies</option>
<option>Groceries</option>
<option>Presents</option>
<option>School Supplies</option>
<option>Gardening</option>
<option>Bank Fees</option>
<option>Appliances</option>
<option>Cars</option>
<option>Weddings</option>
<option>Telephones</option>
</select>
<input type=submit value=" Go "></p>
</form>




Thanks

Jean
 

rwebber77

New Member
Hey Jean, quite a few things going wrong here. In XHTML, you must close all tags and that is a must.

First error...your <B></B> tags must be lower case as XHTML is case sensitive.
Second error...<option selected> should be <option selected="selected"> to become default selection.
Third error...<input type=submit value=" Go "> is all kinds of messed up. You are missing quotations around submit and have not closed the tag. It should read <input type="submit" value="Go" />

Check out this reference as you need some direction. It's fairly old, but you can still learn a lot from it :)
 

jeanm

Member
Thank you for such a quick reply. This is the code they have supplied to me. If I make the changes you have given me it shouldn't mess up anywhere and fail to give me earnings I'm after should it?

I wouldn't have thought so myself but then I'm not knowlegeable about such things.
 

rwebber77

New Member
No problem! If you are worried about earnings it is completely your call...but personally I would change EVERYTHING to be xhtml compliant, especially with a strict doctype. What "strict" means in xhtml is that EVERYTHING must be compliant, whereas "transitional" means you can use older elements and attributes that may not adhere to the current standards, thus giving you more leniency.
 

jeanm

Member
I actually thought I was making it strict xhtml but when I look at my code I have:


<!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">


I've been validating every page as I go and amending things until I had them perfect. That was until I started to introduce this other code. If I change the other code as suggested and then the validation says everything is compliant does that mean I can change the doc type to be Strict as opposed to Transitional?

I feel I am going to a humungous lot of effort with this web site and I would rather have things perfect. So, if I can make it Strict then I would prefer to do that. What are your thoughts please?
 

jeanm

Member
I've been validating every page and making each one perfect thinking my doc type was Strict but now when I look I see I have it as Transitional. If I put each page through the Validator and it passes the test can I change the doc type to say Strict?

I feel I am going to so much effort re-doing this site that I want it to be perfect. This is the doc type as I have it now:

<!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">
 

ronaldroe

Super Moderator
Staff member
It might be better to go ahead and change the doctype to strict. If you validate to transitional and then change it, you may find a lot more errors just when you thought you were done with everything. No sense in wasting your time validating against rules you won't ultimately be using.
 

rwebber77

New Member
You certainly could change it to strict, or you could leave it the way it sits. If you do change it to strict , make sure you are following the correct syntax otherwise it will never validate. Based on the original piece of code that wasn't working I would leave it transitional for leniency, because those were very basic errors.

If you want to learn and understand, go with strict and do your research when it doesn't validate or function correctly across browsers. After all, transitional is for pansies :)
 

jeanm

Member
Sorry for doubling up on my response before. It looked to me like it wasn't sent so I did it again.

Thank you both for your input. If I use the doctype I currently have and simply change the words Transitional to Strict would that be OK?

I found the code below on the page source of w3.org site so perhaps I could use that. I notice it has one line less code than what I've been using though.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

What do you guys have on your own web sites please?
 
Top