« I’d pay $1.99 for that؟ | Main | Google is an Important Part of the US Infrastructure »

XHTML 1.0 Strict Pages With Javascript-Validated Forms

It’s been too long since I’ve W3C-validated front-end code. Came across a problem with a JavaScript-validated form in an XHTML 1.0 Strict web page because forms are not specced to take the name attribute.

Instead of

HTML:

	<form name="foo"  ... >
		<select name="bar" ... >

JavaScript:

	if (document.foo.bar.value == '') {
		return false;
	}

one should use

HTML:

	<form id="foo"  ... >
		<select name="bar" ... >

JavaScript:

	if (document.forms['foo'].bar.value == '') {
		return false;
	}

About

This page contains a single entry from the blog posted on January 19, 2010 11:11 AM.

The previous post in this blog was I’d pay $1.99 for that؟.

The next post in this blog is Google is an Important Part of the US Infrastructure.

Many more can be found on the main index page or by looking through the archives.