Jorge Godoy wrote:
> Hi!
>
>
> I was thinking here about some implementations that I am doing and about some
> uses of a "patched" version of the TableForm widget. Sometimes I want some
> JavaScript to take actions with my form or complement it with a more dinamic
> part (lets say splitting a form in two parts and adding some dynamic message
> in the middle of it, for example) and then we have to put the "<form></form>"
> pair out, alongside with the submit button.
>
> My idea was then suggesting that this approach be possible with standard TG by
> doing this (pseudo-code only):
>
> class TableLayout(something):
> template = """
> <div>
> widgets in a table layout as of TableForm today
> </div>
> """
>
> class TableForm(Form):
> template = """
> <form ...>
> ${table_layout.display()}
> ${submit_button.display()}
> </form>
> """
>
> This preserves the compatibility with the actual code, allows one to use just
> the layout part with the widgets and allows one to write more flexible forms.
>
> What do you think? Can I try a patch for this? (For both, Table and List
> forms...)
>
Hi Jorge,
IMHO this is not a good idea, at least for TG core. :-(
We have decided to not encourage the use of widgets as a layout
technique in TG core, if you want to do that you're free to do it but
this IMHO is the wrong thing to do, it makes not quite clear at a first
sight what the final result of TableForm.display() will be and how you
may customize it.
I know that when you customize a entire template you need to entirely
copy it but the difference you're proposing only buys you 3/4 lines of
code with a loss of readability.
For example, take the TextField widget and the PasswordField, when I
made them I could just define the template for a TextField and reuse it
by just chancing a parameter but I decided to not do that and instead
copied the entire template just to make things more clear.
Finally the widget your are proposing will be a lot more complicate to
use IMHO:
table_layout = TableLayout(fields=...)
form = TableForm(table_layout=table_layout)
No, that's only my opinion but this IMHO makes things just more
difficult without buying something relevant.
That said you're still free of doing that inside your own projects. ;-)
Ciao
Michele
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk
-~----------~----~----~----~------~----~------~--~---