widgets['form'](value=values,options=options)

Use value not values, used to get me all the time.

-Ian

On 5/9/07, kerinin <[EMAIL PROTECTED]> wrote:
>
> I'm having a really hard time getting widgets to work.  I think this
> code was working last night but now it doesn't seem to be and i have
> no idea why.
>
> Here is my Fieldlist, Form widget, controller and template
> --------------------------------
> class ProjectFields(widgets.WidgetsList):
>         object_id = widgets.TextField(validator=validators.Int())
>         name = widgets.TextField(validator=validators.NotEmpty())
>         description = widgets.TextArea(validator=validators.NotEmpty())
>
>         start_date = widgets.CalendarDatePicker()
>         finish_date = widgets.CalendarDatePicker()
>
>         size = widgets.TextField()
>         cost = widgets.TextField()
>
> project_form = widgets.ListForm( fields=ProjectFields(), action="/edit/
> save_project" )
>
> @expose(template='.templates.edit',format=pretty)
> def project(self,id='New',tg_errors=None,*args,**kargs):
>         if tg_errors:
>                 flash('There was a problem with your input!')
>
>         # retrieve object
>         object = get_object(id,model.Project)
>
>         # construct widget data
>         values = {
>                 'object_id':object.id,
>                 'name':object.name,
>                 'description':object.description,
>                 'start_date':object.start_date,
>                 'finish_date':object.finish_date,
>                 'size':object.size,
>                 'cost':object.cost,
>                 'tags':list()
>         }
>
>         return dict(object=object,form=project_form,values=values)
>
> <?python import sitetemplate ?>
> <html xmlns="http://www.w3.org/1999/xhtml"; xmlns:py="http://purl.org/
> kid/ns#" py:extends="sitetemplate">
>         <head>
>         </head>
>         <body>
>                 <div id="content">
>                         <p 
> py:replace="widgets['form'](values=values,options=options)">Form
> Content</p>
>                 </div>
>         </body>
> </html
>
> ---------------------------------------
>
> The form displays properly, but none of the data in the 'values' dict
> shows up.  Am I passing this data incorrectly or is there something
> else?
>
> Thanks!
> -Ryan
>
>
> >
>

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