Is it possible to place individual widgets within the form or page

2 views
Skip to first unread message

Ed Valentine

unread,
Nov 2, 2009, 4:56:03 PM11/2/09
to ToscaWidgets-discuss
I would like to pretty-up the display and add lines, boxes and place
the individual field widgets on the page and still use TG2 and a
single controller. Is this possible? If so, are there any examples?

Thanks for any suggestions.

Diez B. Roggisch

unread,
Nov 2, 2009, 5:04:12 PM11/2/09
to toscawidge...@googlegroups.com
Ed Valentine schrieb:

If the overall form-structure is ok for you, just inherit from
FormField, and render whatever you need.

Other than that - you can always implement your own form-template, with
the utility-functions you see in the existing forms.

Diez

cd34

unread,
Nov 2, 2009, 11:46:25 PM11/2/09
to ToscaWidgets-discuss
On Nov 2, 4:56 pm, Ed Valentine <ed.j.valent...@gmail.com> wrote:
> I would like to pretty-up the display and add lines, boxes and place
> the individual field widgets on the page and still use TG2 and a
> single controller. Is this possible? If so, are there any examples?

Depending on how involved you want to get, you could either rewrite
the template that is used to create the form (TableForm,ListForm), or,
create a template that places the form fields where you want without
using TableForm/ListForm, or, create widgets to insert items in the
default template.

I've written two widgets for a project and it isn't too difficult.
I've also modified the default render template because help_text and
error_messages get appended to the end of the input object which
causes some lines to wrap which makes things a bit unreadable. I've
also added a red * next to required fields.

class NewWidgetForm(TableForm):
action = '/tools/widgetsave'
submit_text = 'Submit Widget'
template = 'cp.templates.form'

I modified form.mako in my templates directory, taken from the .egg.

The widgets were created based on: http://toscawidgets.org/documentation/ToscaWidgets/create.html
Reply all
Reply to author
Forward
0 new messages