I'm converting a TG1 app with TG1 style widgets and am finding that a
code pattern implemented to add widgets on the fly in TG1 doesn't work
in TG2/TW.   Basically, in an existing form's update_params method,
new fields were being added to a fieldset based upon parameters of the
request/data in model.  This strategy doesn't seem to work in TW.  So,
my questions is what is the best way to create a form that adds
widgets dynamically?

So far it seems that I need to instantiate a new form widget object
for each request and pass it a fields parameter that is the set of
fields needed for the given request. For example,

myfields = [TextField("a"), TextField("b")]... etc
myform = MyForm("formname", fields=myfields)
myform.display(**params) # pass non-field items in display.

Is this the best approach, or is there a better way that can more
mimic what was possible with TG1 widgets?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to