Help - Search - Members - Calendar
Full Version: Default Javascript Template For Xhtml 1.0 Strict Sites
Movable Type Community Forum > Other Product Discussion > Bugs and Odd Behavior
Morten Wang
Should a user choose to have a site that validates as XHTML 1.0 strict, the forms will no longer have a name attribute. The standard JavaScript template (default_templates/site_javascript.tmpl) has an onload event handler for the archives (function individualArchivesOnLoad()) that then stops working in Firefox, according to a thread that came up on the Norwegian JavaScript newsgroup this weekend.

I've rewritten the function so it works both with id and name attributes. It defaults to using the DOM to retrieve the form reference, and fall backs to the old variant if it fails. There's also the possibility of specifying the form identifier as the second argument in the function call. The rewritten version is based on the template in MT v3.3b2, and can be downloaded from http://www.kakeboksen.org/javascript/site_javascript.tmpl

I've also noticed that the same form reference method is used in 'lib/MT/Template/ContextHandlers.pm' (line 2050-2064 in v3.3b2, line 1430-1444 in 3.2), and it will also break under XHTML 1.0 strict. Since I do not know the context where that script element is inserted I cannot say whether this problem is applicable or not (from the name attribute used in the form element it seems to follow I'd expect the answer to be "no").
justG
Excellent, thanks very much! I'm still constructing my site and haven't validated it yet; no doubt this will come in handy when I do. =)

- Gita
TweezerMan
QUOTE (Morten Wang @ Jun 18 2006, 08:54 AM) *
I've also noticed that the same form reference method is used in 'lib/MT/Template/ContextHandlers.pm' (line 2050-2064 in v3.3b2, line 1430-1444 in 3.2), and it will also break under XHTML 1.0 strict. Since I do not know the context where that script element is inserted I cannot say whether this problem is applicable or not (from the name attribute used in the form element it seems to follow I'd expect the answer to be "no").

The above references are from code for the <MTCommentFields> tag, which can be used to generate a comment submission form on a template. It can be used on the Comment Listing, Comment Preview, and Individual Entry Archive templates. The javascript code it inserts is now in the Site Javascript template.

The <MTCommentFields> tag is no longer used in the default templates for either MT 3.2 or the MT 3.3 beta. The javascript code it inserts would be an issue only to someone who is using an <MTCommentFields> tag in their templates (such as someone who upgraded from MT 3.0x or MT 3.1x).
Morten Wang
Thanks David! Since the code refers to older versions I'll let it be.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.