Moron Forms Redux »
So I'm browsing the new layout of the site (which isn't done yet, I know). And I notice I'm getting javascript errors on my individual archives. Geez. I know I had solved this before. So about half an hour later it dawns on me that I've added a search form to my site. As a result, the comments form isn't the first form on the site. It's now the second.
So instead of using:
document.forms[0].author.value = getCookie("mtcmtauth");
I need to use:
document.forms[1].author.value = getCookie("mtcmtauth");
What's worse is that I knew this! Heck, I think I even posted it at one point. Nonetheless, the offending code is fixed, and the XHTML now validates again, as it should.
If anyone happens to know how to reference a form by ID (as opposed to name, which is no longer valid), please let me know. Then I don't have to worry about this kind of thing happening again!





















Comments (1)
Set the name / id (I don't recall which) attrib of the form tag. [form name='comments_form'] ... [/form]
The form then shows up in the HTML DOM as e.g. document.comments_form
Posted by sKware | July 29, 2004 8:11 AM