Hi. I'm working with deform. I'm resisting the urge to make my own
templates, as my needs are not all that custom; I simply want to do simple
things like having radio choices side-by-side rather than stacked up, or
having some fields on the left column, some in the right. So, I'm looking at
the generated html and hoping to use css selectors to style my deform
output.

I'm having trouble finding out how to set class and id attributes, and I see
things like this in the code:

field.py:
self.oid = 'deformField%s' % self.order

hidden.pt:
<input type="hidden" name="${field.name}"
value="${cstruct}" id="${field.oid}"/>

This would seem to indicate that users of deform have no way to set the dom
id of a form element. Is this true? Having them enumerated as such means we
could look into the generated code and then make a style sheet, but this
would be super-brittle, especially if the forms were generated and the order
wasn't necessarily super predictable.

I do see that we can pass "css_class" to widgets, but this doesn't affect
the <li> or <label> or anything; it's not much use to only style the input
element.

Also, it doesn't seem like the templates actually lead to the expected
output... for example, here is textinput.pt:
<span tal:omit-tag="">
    <input type="text" name="${field.name}" value="${cstruct}"
           tal:attributes="size field.widget.size;
                           class field.widget.css_class"
           id="${field.oid}"/>
    <script tal:condition="field.widget.mask" type="text/javascript">
      deform.addCallback(
         '${field.oid}',
         function (oid) {
            $("#" + oid).mask("${field.widget.mask}",

{placeholder:"${field.widget.mask_placeholder}"});
         });
    </script>
</span>

And here is a textinput as rendered by form.render():
<li title="" id="item-deformField1">
  <!-- mapping_item -->
  <label class="desc" title="" for="deformField1">Email<span class="req"
id="req-deformField1">*</span>
  </label>
      <input type="text" name="email" value="hi" id="deformField1" />
    <!-- /mapping_item -->
</li>

What happened to the span? Where did the <label> come from? This may just be
me not understanding Chameleon templates...

What are some good strategies for working with styling deform output? Maybe
someone can point me to a post somewhere, or maybe just help?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to