Hi,
Got the button to appear next to the textfield. Here is the template:
class MyTableForm(TableForm):
fields = MyFields()
template = """
<form xmlns:py="http://purl.org/kid/ns#"
name="${name}"
action="${action}"
method="${method}"
class="tableform"
py:attrs="form_attrs">
<table py:attrs="table_attrs">
<tr>
<td py:content="display_field_for('query')" />
<td py:content="display_field_for('submitbtn')" />
</tr>
</table>
</form>
"""
Thanks for your help!
On Jan 12, 11:19 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
> vrs762 schrieb:
> > Could you please show me a simple example? I tried the custom template
> > examples I couldn't get the submit button to appear.
>
> Try something like the following (untested). It puts the submit button
> at the right side of the field with the index submit_index which you can
> pass as a parameter to the Form.
>
> -- Chris
>
> class MyTableForm(TableForm):
> template = """
> <form xmlns:py="http://purl.org/kid/ns#"
> name="${name}" action="${action}" method="${method}" class="tableform"
> py:attrs="form_attrs">
> <div py:for="field in hidden_fields"
> py:replace="field.display(value_for(field), **params_for(field))"/>
> <table cellspacing="0" cellpadding="2" py:attrs="table_attrs">
> <tr py:for="i, field in enumerate(fields)">
> <th><label class="fieldlabel" for="${field.field_id}"
> py:content="field.label"/></th>
> <td><span
> py:replace="field.display(value_for(field), **params_for(field))"/>
> <span py:if="error_for(field)" class="fielderror"
> py:content="error_for(field)"/>
> <span py:if="field.help_text" class="fieldhelp"
> py:content="field.help_text"/></td>
> <td
> py:content="i==submit_index and submit.display(submit_text) or None"/>
> </tr>
> </table></form>
> """
> params = ["submit_index"]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---