Hi Robin,
Sorry but I just noticed your question, anyway I suggest you use two
different names, what about something like this? you need to customize
the template of a TableForm obviously:
class RobinForm(widgets.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),
**options_for(field))"
/>
<table border="0" cellspacing="0" cellpadding="2">
<tr py:for="i, field in enumerate(fields)" class="${i%2 and
'odd' or 'even'}">
<th>
<label class="fieldlabel" for="${field.field_id}"
py:content="field.label" />
</th>
<td>
<span py:replace="field.display(value_for(field),
**options_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>
</tr>
<tr>
<td> </td>
<td colspan="2">
<span py:replace="edit_button.display(edit_text)"
/>
<span
py:replace="delete_button.display(delete_text)" />
</td>
</tr>
</table>
</form>
"""
member_widgets = ["edit_button", "delete_button"]
template_vars = ["edit_text", "delete_text"]
edit_button = widgets.SubmitButton(name="edit")
edit_text = "Edit"
delete_button = widgets.SubmitButton(name="delete")
delete_text = "Delete"
Robin Haswell wrote:
> Hey - I noticed you said there was an easy way to do this in .9a2. I'm
> in .9a2 now and I too find myself wanting to lay out two submit buttons
> side-by-side (Edit, Delete). They also need to share the same name so I
> can find out which one was clicked. Any advice would be much appreciated :-)
>
> Thanks
>
> -Rob
>
> Michele Cella wrote:
> > Steve Bergman wrote:
> >
> >>I'd still like to know how to put the buttons side by side, though.
> >>
> >
> >
> > In 0.9a2 there will be an easy way to customize your layouts, anyway
> > what you need to do as suggested by Nicky Ayoub is subclassing Form ad
> > use a custom template or even update_data, the submit button name is
> > "submitted" only if you give that widget a name. ;-)
> >
> > Ciao
> > Michele
> >
> >
> > >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---