lmwangi wrote:
> Hi all,

Hi,

>  I am trying to set up default values for widgets in TG. By calling
> AddAdminFields with a dictionary that has the defaults. so that the
> name widget now becomes
> name =
> widgets.TextField(validator=validators.NotEmpty,default='SomeAdmin')..
>
> Is there a way i can do this? I have tried using methods to modify the
> class vars but ....
> Here is a snip

Pass at the form display method your prepopulated dict:

form.display(value=default_values)

where:

default_values = dict(name="SomeAdmin")

name is the name of your fields, if you also have email you can do
this:

default_values = dict(name="SomeAdmin", email="[EMAIL PROTECTED]")

rember that form and default_values are passed by your controller
method.

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

Reply via email to