Yeah that is how it works right now. I build the dictionary "value" in the controller then I pass that to the model and it get passed into the display method of the $form.
I am going to take a stab at converting the widgets docs to kid templates this week. I would like to add a non trivial example to the docs that submits a registration form to itself. It saves the data, and creates TG_Users (groups + permissions stuff). Anyway, I will try with a less complex use case and let you know if I have any problems.

Thanks,
Lateef

On 4/9/06, Alberto Valverde <[EMAIL PROTECTED]> wrote:


On Apr 9, 2006, at 8:18 PM, lateef jackson wrote:

> Ok so I added a validator to my edit.
> @turbogears.validate(form=myforms.COOL_FORM)
> def cooledit(self,...):
>   dict(editValues=..)
>
> So the problem I am having is that if I use the validator decorator
> the form is not populated when it is first loaded. If I modify the
> data and submit it (submits to itself) it works correctly. If I
> comment out the validator decorator then I get the expected
> behavior of on first page visit the data is populated from the
> values I passed into the view from the controller. And it works
> fine submitting to itself. Is it frowned on to use widgets and
> submit to the same controller function? Or do we think there is a
> bug in my code?

Have you tried passing a value to the form in the template?

def controllermethod(...)
        ...
        return dict(form=form, value=dict(name="Haifa", surname="Wehbe"))

(in the template)

${form.display(value=value)}


Alberto.





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