The Validator Is Your Friend
First Kudos to the Yahoo! team for quickly fixing the problems identified in yesterday's post. Now that the server is well behaved, onto the client.
Taking the PHP sample and running it through the W3C validator and fixing all the problems it reports results in the following version. Fixes include internationalization, avoiding a number of browser quirks, and potential security problems from not properly escaping data from third party sources.
I also removed one assumption that required the script to be placed in the root directory.
The result is being made available under the same BSD license as the original.
Anne - I'm having a hard time justifying that - what's the payback? As you know, if I were doing this for my personal use I would use XHTML 1.1 strict.
My intent was do the minimum necessary to get this to work. Only the header line is precisely necessary to solve the immediate problem. The other changes, however, also solve real, if rare, problems.
Using the
LABEL element would make the form more usable and accessible. I do not really care about the block level element, but Yahoo might want to do it entirely correct.
Posted by Anne at
Sample code which is valid (even semantic) (X)HTML is better than sample code which isn't.
Of course, it's not your sample code. But, like my momma said, "If it's worth doing something, it's worth doing it right."
Posted by Jacques Distler at<chuckle/>
Recap:
- The original sample produced invalid HTML.
- Before I endeavored to make any changes, I first changed the sample to produce valid HTML. It turns out that that was all I needed to do.
- What Anne is referring to is that I set my bar rather low: valid HTML 4.1 transitional.
But, for those who like such a thing, YahooSearchExampleX.phps. Valid XHTML 1.1. Complete with the correct Mime type (to browsers that support it).
Enjoy.
Posted by Sam Ruby atAnne van Kesteren : The Validator Is Your Friend - Helping out Yahoo....
Excerpt from HotLinks - Level 1 at
I suggest you add
LABELelements and perhaps a block level element around the form controls so it validates as HTML 4.01 Strict.Posted by Anne at