Hello,

I've read your emails and check the web pages you reference. But I'm
still not able to do such things.

So to make things clearest as possible, I've made a small test inspired
by
http://docs.turbogears.org/1.0/SimpleWidgetForm#form-display-revisited:
which you use in controllers.py

----- controllers.py

class Root(controllers.RootController):

   @expose(html="turbobs.templates.test", allow_json=True)
   def test(self):
       class CommentFields(widgets.WidgetsList):
           """The WidgetsList defines the fields of the form."""
           name = widgets.TextField(validator=validators.NotEmpty())
           email = widgets.TextField(
                         validator=validators.Email(not_empty=True),
                         attrs={'size':30}    )
           comment = widgets.TextArea(validator=validators.NotEmpty())
           notify = widgets.CheckBox(label="Notify me")
       comment_form = widgets.TableForm(fields=CommentFields()
                                    ,action="save" )
       data = dict(name='Joe', comment='Hello World', notify=True )
       comment_form(data, submit_text='Add Comment')
       return dict(form=comment_form)

-----

and the template associated with it

----- test.kid
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#";
   py:extends="'master.kid'">

<head>
   <meta content="text/html; charset=UTF-8" http-equiv="content-type"
py:replace="''"/>
   <title>Welcome to TurboGears</title>
</head>

<body>
  <p py:content="form()">add people form</p>
</body>
</html>

-----

> David E schrieb:
>> Notably, it looks like when using your widget you can try
>> add_people_form(value=dict(lastname='joe'))
>
> Yes, this is correct. See also here:
>
> http://docs.turbogears.org/1.0/SimpleWidgetForm#form-display-revisited
Yep I've been looking at this one.... but the small test above show me
that this is not working ! or maybe I've made some mistakes

>
> This might be useful too:
>
> http://docs.turbogears.org/1.0/RoughDocs/WidgetsOverview#tips

The arguments-to-children tip only applies to ToscaWidgets (docs
should state this more clearly and provide TG's way of doing it).
To pass arguments to child widgets in TG widgets another syntax must
be used.

in TG:

form.display(value, repetitions=dict(address=3))
in this example, I don't see any class declaration I can refer too. So
I don't know what is:
- value
- repetitions
- ....

Alberto

So if someone (I know that this can look as too much asking) can give
me an example which work, so I can give a look. :)

thanks for your help

Ced.


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