Am 29.07.2010 um 01:23 schrieb Michael Pearce:
I have been using the TableForm widget for my TG2 forms. This uses
the following template:
"""
<form xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
id="${id}"
name="${name}"
action="${action}"
method="${method}"
class="${css_class}"
py:attrs="attrs" >
<div py:if="hidden_fields">
<div py:for="field in hidden_fields"
py:with="error=error_for(field)"
py:strip="True">
<span py:replace="field.display(value_for(field),
**args_for(field))" />
<span py:if="show_children_errors and error and not
field.show_error"
class="fielderror" py:content="error" />
</div>
</div>
<table border="0" cellspacing="0" cellpadding="2"
py:attrs="table_attrs">
<tr py:for="i, field in enumerate(fields)"
id="${field.id}.container"
class="${i%2 and 'odd' or 'even'}"
title="${hover_help and help_text or ''}"
py:attrs="args_for(field).get('container_attrs') or
field.container_attrs"
py:with="required = [None,' required']
[int(field.is_required)];
error = error_for(field);
label_text = field.label_text;
help_text = field.help_text;" >
<td py:if="show_labels and not field.suppress_label"
class="labelcol">
<label id="${field.id}.label" for="${field.id}"
class="fieldlabel${required}"
py:if="label_text" py:content="label_text" />
</td>
<td class="fieldcol" py:attrs="show_labels and
field.suppress_label and dict(colspan=2)">
${field.display(value_for(field), **args_for(field))}
<span class="fieldhelp" py:if="help_text and not
hover_help" py:content="help_text" />
<span py:if="show_children_errors and error and not
field.show_error"
class="fielderror" py:content="error" />
</td>
</tr>
</table>
<span py:if="error and not error.error_dict" class="fielderror"
py:content="error" />
</form>
"""
This provides a 'submit' button. How can I add a 'cancel' button so
that it is displayed next to the submit button? I have tried to add
a column to the table, but this seems to be more complicated than
using standard html. Any assistance would be appreciated.
You can copy the template and just add a delete and submit button in a
row after the fields.
But seriously - are these *used* these days? I can't remember clicking
on one of them ever...
Diez
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.