On Thu, Dec 15, 2005 at 02:41:33PM +0100, bruno desthuilliers wrote:
>
> Hi all...
>
> I started playing with/digging into TG widgets and forms, and a few
> things came to my mind that I felt I would share (not sure it's really
> interesting but...).
>
> * first thing:
> an interesting feature of Zope is the ability to have multiple submits
> on the same form, with a naming scheme specifying the real action for
> the form, ie:
> <submit name="handlerMethodName:method" .... />
> will use <current_controller>.handlerMethodName() as handler (ZPublisher
> takes care of this dispatch)
>
> (err... not sure I'm very clear... sorry)
>
> This is definitively something I'd like to have in a TG forms/widgets
> framework, and I thinks this could be easily implemented in TG (at least
> with a default() handler doing the dispatch, but there may be better
> options with cherryPy filters or whatever)
>
There is nothing special about multiple submit buttons
(neither javascript nor any special Zope syntax needed), e.g.
<form action="myaction"
method="post">
<input type="submit"
name="change"
value="Ändern"
/>
<input type="submit"
name="delete"
value="Löschen"
/>
</form>
and in controllers.py
@turbogears.expose()
def myaction(self, change=None, delete=None):
if change:
...
elif delete:
...
...
I can't comment on the widgets though as I haven't used them yet.
- I guess it would be possible to do something like the above example
with widgets though.
Just my 2 cents.
-Andreas
>
> * Next thing is about form layout:
>
> The TableForm strategy is a first angle, but it will only work for very
> simple forms[1].
>
> What I was thinking of is a combination of RowLayouts and ColumnLayout
> (both being widgets and widgetContainers). A RowLayout could contain one
> widget by cell, a ColumnLayout could contain one widget by line :
>
> - simple row layout :
> +---------+---------+---------+
> | widget1 | widget2 | widget3 |
> +---------+---------+---------+
>
> - simple column layout :
>
> +---------+
> | widget1 |
> +---------+
> | widget2 |
> +---------+
> | widget3 |
> +---------+
>
> We could even make [Row|Column]Layouts accept many widget per cell, with
> RowLayout displaying them vertically and ColumnLayout horizontally:
>
> - multi row layout:
> +---------+---------+
> | widget1 | widget3 |
> | widget2 | widget4 |
> | | widget5 |
> +---------+---------+
>
> - multi column layout :
>
> +-------------------------+
> | widget1 widget2 widget3 |
> +-------------------------+
> | widget4 widget5 |
> +-------------------------+
>
>
> Now RowLayout and ColumnLayout being widgets themselves, one can combine
> them to make more complex layouts:
>
> +-------------+------------------------+
> | +---------+ | +--------------------+ |
> | | widget1 | | | widget4 | widget6 | |
> | +---------+ | | widget5 | | |
> | | widget2 | | +--------------------+ |
> | +---------+ | +--------------------+ |
> | | widget3 | | | widget 7 | |
> | +---------+ | +--------------------+ |
> +-------------+------------------------+
>
>
> etc...
>
> Since I do not yet fully understand how TG widgets work, I don't know
> which implications it would have, but I guess this should be possible...
> Now is it a good idea is another question !-)
>
>
> [1] (TableForm...) and it needs to handle hidden input widgets anyway
> IMHO - I tried adding something like this yesterday, but I guess it was
> way too late for my poor brain to still perform correctly :(
>
> --
> bruno desthuilliers
> développeur
> [EMAIL PROTECTED]
> http://www.modulix.com
>
>
> !DSPAM:43a1793236851637432971!