I am considering developing a module that regularly (using cron) checks a Drupal site (all or part) against various validation schemes such as the W3C's Markup Validation Service, CSS Validator, and Web Content Accessibility Guidelines 1.0, and the U.S. Section 508 Guidelines. The Drupal core and most of the essential modules already validate nicely against these tests, but obviously any user-submitted code would be at risk. I would hope that if validation holes were found in modules or themes published on Drupal.org, it would be enough to raise issues in the appropriate place to get them plugged.

The admin page could allow an administrator to indicate, using regular expressions, the pages on their site that would be checked, the interval at which to check, and an option list of validators.

Is this something that others would find useful?

Comments

Steven’s picture

I like the idea of checking your own pages, but I don't think it should be used to check against invalid user submissions.

There is already htmlcorrector.module which does some basic HTML well-formedness checks (basically just ensures proper tag closing/nesting), but you could make a similar module which does proper validation.

There is also htmltidy.module which runs every page through html tidy.

slower’s picture

Man, I hadn't even seen the htmltidy module. I've used tidy in jEdit and it is indispensable. I think that module is enough for me. I don't suppose a site's code will change enough on a day-to-day basis that a cron-based validator with some kind of e-mail alerting system would be necessary. Nay, that would be anal.

Thanks for the reply.

ultimante’s picture

"The Drupal core and most of the essential modules already validate nicely against these tests"

That hasn't been my experience. I get duplicate error with drupal's form code that appears at the bottom of pages for comments. Maybe somebody can explain it?

# Error  Line 64 column 79: document type does not allow element "form" here; missing one of "object", "ins", "del", "map" start-tag.

...ttp://www.domain.com" method="post">

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

✉
# Error Line 65 column 65: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

...ype="hidden" name="edit[destination]" value="user" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

✉
# Error Line 66 column 110: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

..." id="edit-name" size="15" value="" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

✉
# Error Line 67 column 118: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

..." id="edit-pass" size="15" value="" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

✉
# Error Line 68 column 52: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

			  <input type="submit" name="op" value="Log in" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

admin-olpsc’s picture

i have found that I can get my sites html validation errors to nil if I use Pushbutton theme but that Theme is not the one I want to use, Chameleon which I prefer creates validation errors.

I am not a Drupal developer, php expert or CSS expert I do not want to have to rewrite the Chameleon theme to get it to validate. I just want to use a CMS to put up my site and have it validate. For that I am finding drupal frustrating.

Drupel's own home page has 13 W3c vaildation errors.

My site is about standards and I want to showcase a CMS that can be used and is compliant and you do not need to be a developer to do it.

In all other respects Drupal is fantastic.

admin-olpsc’s picture

Chameleon now validates. In no respects is drupal not now fantastic.

robert castelo’s picture

I wrote a page for the handbook about accessibility:

http://drupal.org/node/44661

All the core themes now validate, hurraa!

I'm working on another page about valid markup, one of Drupal's most amazing features. It's quite a complex subject so is taking a while to finish, hopefully I'll have it up for review next month.

Cortext Communications
Drupal Themes & Modules

------------------------------------------
Drupal Specialists: Consulting, Development & Training

Robert Castelo, CTO
Code Positive
London, United Kingdom
----