I'm pretty sure you're not allowed dots in ids of HTML elements. At
least not when they are prefixed by 'form'. A zope.schema.TextLine in a
formlib form, for example, generates HTML like this:
<input id="form.title" class="textType" type="text" value="Changed
title" size="20" name="form.title"/>
In particular, we want to style the fields to look a bit more like
Plone, and we have special cases for "title" and "description" that we
want to style by ID, not class.
However, CSS like this has no effect in Firefox or Safari:
font-family: <dtml-var headingFontFamily>;
font: 100% <dtml-var fontFamily>;
Not all that surprising - it could look like I'm styling a form with
I then hacked zope.app.form.widget's renderElement() function to look
def renderTag(tag, **kw):
"""Render the tag. Well, not all of it, as we may want to / it."""
if 'id' in kw:
kw['id'] = kw['id'].replace('.', '-')
The tests in zope.app.form still pass.
Hacky, but the alternatives are to (a) override all the widgets or (b)
at least provide custom ones only for the purpose of getting stylable
ids on various fields. renderTag() is called from a lot of places with
id=self.name. We could fix all those, too, of course.
I would be happy to submit a patch for either the explicit check in
renderTag() or for changing all calls to this in zope.app.form.
However, if someone has depended on the ids being with dots (possibly
not quite as likely as it may seem, since these forms are typically
auto-generated) then we may not have a decent way of deprecating that.
Zope3-dev mailing list