Fix Bug 840746: Add JavaScript form errors.

Adds a JS shim that detects if HTML5 form validation is supported and,
if it isn't, activates some simple form validation. The only attribute
supported is required since it's the only one we use.
Review fixes.