Hi,
we'd like to add a few custom fields to our trac installation. One of
these fields
is a checkbox, that must be checked by default. So I set the value to
"1" in the
trac.ini. This value is placed in the value attribute of the checkbox,
which doesn't
help very much, since the state of a checkbox is determined by the
attribute
checked.
Did I make a mistake or is this a known (or even new) bug?
Now to the genshi part of the subject. I tried to tweak the genshi
templates, so that
the checked attribute would show up. I changed the lines pertaining to
checkboxes
in ticket_new.html to the following:
<input py:when="'checkbox'" py:if="field.value == 1"
type="checkbox" id="field-${field.name}"
name="field_${field.name}" value="${field.value}"
checked="checked" />
<input py:when="'checkbox'" py:if="field.value == 0"
type="checkbox" id="field-${field.name}"
name="field_${field.name}" value="${field.value}" />
This leads to the checkboxes not being displayed at all.
Later I tried the following code in trac.ini:
[ticket-custom]
cb1_test = checkbox
cb1_test.label = Some checkbox
cb1_test.value = checked
cb2_test = checkbox
cb2_test.label = Another checkbox
cb2_test.value = unchecked
and in ticket_new.htnl:
<input py:when="'checkbox'"
type="checkbox" id="field-${field.name}"
name="field_${field.name}" value="${field.value}"
checked="${field.value}" />
which funnily leads to:
<tr>
<th class="col1">
<label for="field-cb1_test">Some checkbox:</label>
</th>
<td class="col1">
<input type="checkbox" id="field-cb1_test"
name="field_cb1_test" value="checked" checked="checked" />
</td>
<th class="col2">
<label for="field-cb2_test">Another checkbox:</label>
</th>
<td class="col2">
<input type="checkbox" id="field-cb2_test"
name="field_cb2_test" value="unchecked" checked="checked" />
</td>
</tr>
What can I do to make this work? BTW can anybody explain why
${field.value} changes value for the second checkbox????
Further I have read of some more interesting features concerning the
placement
of the custom fields, is there a "better" or more up to date
documentation than
TracTicketsCustomFields around?
TIA
Max
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Trac Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---